Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar file execution in linux.

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have opened a topic under http://www.coderanch.com/forums/, but then realised this might be an apt place.

I have created a swing application under windows enviroment using netbeans. It works perfectly fine when I double click the jar file. Then I moved my source code under linux machine /home/userrig/temp/testing.jar. If I chane my dir to cd /home/deo/temp and start executing jar like
, swing application starts executing. But if I try to start the swing application under /home like
, I get the error as follows.

Do I have to set the path for this jar instance? How do I proceed.
Next question is whether to go KDE or GNOME for icon creation. I have just started reading about them. Or writing any batch script is enough to start the application. Thanks.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There shouldn't be any problem whether you do

or

Both do the same thing.

I think probably there's a hardcoded path or something in the
testing.testing.createGUI(testing.java:200)

If you can provide the code for that method, maybe someone here can help.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I developed the application in netbeans and then deployed the jar file in linux using ssh and tested it. I always went for "clean and build" option in netbeans to create jar file. I just now noticed that I get the same nullpointerexception if I try to do "run Project" in netbeans. I have not harcoded any where in the application.
My main method is as follows



createGUI is a method which instantiates all the swing components and so on. Is there anything to do with netbeans properties?
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's very strange. It could be that some of the NetBeans' project config files are corrupted. Can you try to create a new Project in NetBeans and copy over all the source files and build them again.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out. Since I am reading some info from a config.properties file, I had to put a copy of config file from where I can launch my jar file. Once it is done, I am able to lauch from



So teh config.properties file has to be in the directory from where the application can be launched or is tehre any other way to handle this situation?

My next goal is to create an icon on linux desktop so that if the user wants to open the application, just a double will do. Any reading material to start with? Thanks.
[ May 08, 2008: Message edited by: Gopu Akraju ]
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Gnome, ff you do it manually, just right click -> Create Launcher -> enter the name and command. If you wanna do it programmatically, you need to create a desktop file in your $HOME/Desktop, e.g.

test.desktop
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic