NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: juliaB on October 04, 2011, 11:11:22 pm



Title: Using own classes with import possible
Post by: juliaB on October 04, 2011, 11:11:22 pm
Hello,

is it possible to use own classes in an ejs simulation that are packed in a jar file.

I tried to pack my class in a jar file and did put it in ejs under run option in jar libraries, and tried an import (also under run option), but that did not work.

If anybody has successfully done so, I would be grateful for a step by step explanation.

Right now I did make an ejs simulation, put the classes made by ejs in eclipse, made some improvements (including new classes) and now would like to get those back in ejs.

I can just copy the new classes in my ejs simulation, but that only sort of works, meaning, everything works like in eclipse, but in the console there are many complaints about my classes I do not get with them in an extra file in eclipse. Also it makes the code less reusable.

Thank you,

Julia



Title: Re: Using own classes with import possible
Post by: Fu-Kwun Hwang on October 05, 2011, 04:59:22 pm
Please check out EJS version of Fourier Synthesis (You can hear the sound,too!) (http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1073.msg4021#msg4021).

I create my own java class to generate sound, and added it to EJS.

Add jar under run option, and add import statement, then you should be able to used it in the code.

Please do check out the above example.


Title: Re: Using own classes with import possible
Post by: juliaB on October 06, 2011, 05:05:43 am
Hello again,

thank you so much for the example, I now was able to use a class out of a jar file, I had only put the Jar File in the Field Jar Libraries under Run Configurations and not also under Files required. I would never have guessed without the example, that this was the problem.

Julia


Title: Re: Using own classes with import possible
Post by: Fu-Kwun Hwang on October 06, 2011, 02:59:58 pm
Great! You can make it.
I hope you can post your result and share it with other users soon!  ;D


Title: Re: Using own classes with import possible
Post by: lookang on October 06, 2011, 08:31:04 pm
yes juliaB,
do share your creative works in this forum  ;D


Title: Re: Using own classes with import possible
Post by: juliaB on October 07, 2011, 07:02:09 pm
As soon as I am finished to my satisfaction I will post my work. Thank you for your encouragement.

Julia


Title: Re: Using own classes with import possible
Post by: alempitt on November 09, 2011, 05:35:51 pm
How can I use EJS in ExpressJS instead of Jade???
-*-


Title: Re: Using own classes with import possible
Post by: juliaB on July 12, 2013, 06:04:12 pm
It seems to have taken me a long time to post the result, but please accept my thanks for your encouragement.



Title: Re: Using own classes with import possible
Post by: Fu-Kwun Hwang on July 12, 2013, 06:10:04 pm
Great! You can upload ejs created jar file by yourself,too!

You will find "upload new EJS jar file" check box just below the edit region when you post message.
Click the check box , then select jar file.
The jar file will be uploaded when the message is saved.
And the simulation will appear automatically as part of message.
Try it. I will help you to make it work if you can not make it work.  


Title: Re: Using own classes with import possible
Post by: juliaB on July 12, 2013, 06:44:36 pm
Here it comes?!