Jump to content

I need a solution to starting Slick 2D/LWJGL Java project via command line

- - - - -

  • Please log in to reply
3 replies to this topic

#1
liamzebedee

liamzebedee

    Programmer

  • Members
  • PipPipPipPip
  • 129 posts
Currently I am starting my Slick 2D application via this batch file-

java -Djava.library.path=lib -Xms512m -Xmx512m -jar myapp.jar %1
Where lib is the folder that contains the LWJGL/Slick libraries and myapp.jar is my application.

Although this is easy and effective I want to be able not to have to run a script all the time and actually create a java .jar to do this.

So my question is, how would I 'convert' this batch script into Java code?

If anyone knows of the Java game called Minecraft (you should, it is awesome) I would like to create a launcher similar to this.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Part of what's being done here is giving memory settings to the JVM, telling the JVM that it's opening a jar, etc. You're probably better off leaving it alone.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
liamzebedee

liamzebedee

    Programmer

  • Members
  • PipPipPipPip
  • 129 posts
So is there an equivalent to
java -Djava.library.path=lib -Xms512m -Xmx512m -jar myapp.jar %1
in Java?

#4
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Well, with Java you can access the commandwindow basicly, by using the Runtime class and doing exec(string);
So I gues you could create a jar, which does only that, the jar will, or should start up myapp.jar. And then die so only myapp is running.
I just hope myapp will not die together with this other jar as it's created by it.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users