• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

run game from command line, from a working game project in Eclipse

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone help me to transform an Eclipse run configuration into a Java command-line?

I have a project in Eclipse involving jars and DLLs that runs fine and has done for months, but I now want to run it from the command line and I can't find how to translate all the run configurations into command line parameters properly
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you want to run? A jar? Or just the file?

What kinds of things are in eclipse's configuration? Can't you just set the classpath, compile, and run?
 
Andrew Pidcock
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not mind if it's packages as a jar or if it's loose files - I just want it to run

stuff in the project: well there are DLLs, jars, a whole bunch of things - it's openGL and openAL

I've tried setting the classpath to various directories, but it can't run.. it wants its various jars and things
 
Kevin Workman
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrew Pidcock wrote:I do not mind if it's packages as a jar or if it's loose files - I just want it to run

stuff in the project: well there are DLLs, jars, a whole bunch of things - it's openGL and openAL

I've tried setting the classpath to various directories, but it can't run.. it wants its various jars and things



You could just export the whole thing as a runnable jar.

But if "it wants its various jars and things", then you have to make sure that they're all on the classpath. You can't just set it to "various directories" and hope for the best.
 
Andrew Pidcock
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse has a "export to runnable jar" and I have tried that, but when I try to run it, nothing happens and I see no error messages

I suspect it is that it cannot find the jars and DLLs - can you tell me how to see error messages from running a runnable jar? That would be a place to start
 
Ranch Hand
Posts: 140
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of exporting to a "runnable jar" try exporting to a regular jar. The last page of the export wizard will give you an option to specify the class with the "main()" function. If you specify this, it will work both as a file that you can click on (in windows) or run from the command line via:

java -jar yourfilename.jar

It should give you any needed error messages, for example, if it can't locate a class because it was not included in the export.

Also, the export to jar wizard is not the easiest--lot's of gotchas in it, imho. On the page where you select the classes to export, make sure that you expand out all of the tree, and click on each package to ensure that all the classes you want to export are marked for export. It's really easy to mistakenly just export a single class or package from a larger project.

You can also copy the jar into a name with a .zip extension and examine the contents that way to see if all the libraries are there or not.

If this doesn't help, also consider the Eclipse 'newbies' forum. They've been tremendous in helping me in the past.

Good luck!
 
Andrew Pidcock
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks mate

The other day, blind and deaf, I just tried a few things and got it to work.. I do not know how

I asked Eclipse to make me a runnable jar, and I dumped all the DLLs and JARs into the same dir as the jar, and the /sounds and /images dirs as well, and it ran

So I can now deliver =)
 
Phil Freihofner
Ranch Hand
Posts: 140
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it works, it works! That's great.

The next level will be when you figure out how to get ALL the resources to fit into a single, clickable jar. Not a trivial task, but not insurmountable either. I've done this with image and sound files but never had a call to also pack dlls.
 
Andrew Pidcock
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
indeed yes, but I am at the point now where I can share with my friends

If the NSI installer won't work with this setup THEN comes the next step
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic