Author Topic: Java question  (Read 1640 times)

Xeen

  • VIP
  • Member
  • ***
  • Posts: 1,065
  • Kudos: 55
Java question
« on: 15 October 2003, 03:19 »
If I write a program consisting of several classes all in java, is there any way for me to convert it to Windows exe and/or dll files? I ask because I'm writing a program but do not want to have it launch in Windows by having to type the command java classname in command line. I want to be able to create an executable file for it. Any ideas?

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Java question
« Reply #1 on: 15 October 2003, 03:42 »
Create a .bat file.
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


Stryker

  • VIP
  • Member
  • ***
  • Posts: 1,258
  • Kudos: 41
Java question
« Reply #2 on: 15 October 2003, 04:02 »
or a shortcut

Xeen

  • VIP
  • Member
  • ***
  • Posts: 1,065
  • Kudos: 55
Java question
« Reply #3 on: 15 October 2003, 04:10 »
perhaps I should explain my problem in more detail. My java program is NOT command line. It has a GUI. So if I create a batch file or shortcut to the file then Windows will still open the command prompt window which will stay there until the java GUI is closed. Is there any way to get around this problem? I want my program to run like any other program, without any command line windows behind it.
I know this problem wouldnt exist if I were writing in C++ but I don't know c++, but know java very well.

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Java question
« Reply #4 on: 15 October 2003, 04:14 »
No, that isn't possible.
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


Xeen

  • VIP
  • Member
  • ***
  • Posts: 1,065
  • Kudos: 55
Java question
« Reply #5 on: 15 October 2003, 04:15 »
quote:
Originally posted by flap:
No, that isn't possible.


Crap   :confused:

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Java question
« Reply #6 on: 15 October 2003, 04:21 »
Blame Microsoft. It's because of Windows' utterly rudimentary support for terminal applications. Under Unix you could run it in the background from a terminal window, or run it attached to a non-tty so you wouldn't have to have a term window open at all. No such option in braindead windows.

[ October 14, 2003: Message edited by: flap ]

"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


Stryker

  • VIP
  • Member
  • ***
  • Posts: 1,258
  • Kudos: 41
Java question
« Reply #7 on: 15 October 2003, 04:26 »
can you modify your java program to use some of of the windows' api calls and find the dos windows that opens up and hide it? It'll be a little bit of extra work, and i'm not sure if java is capable of such things.

SAJChurchey

  • Member
  • **
  • Posts: 246
  • Kudos: 0
    • http://sajchurchey.htmlplanet.com
Java question
« Reply #8 on: 15 October 2003, 21:34 »
There has to be a way to execute Java programs w/out that window.  Because there are applications written by Sun in Java that runs in Windows just fine w/out a terminal window.  I never programmed java on a Windows platform.  Can you tell me more about batch files and such?
SAJChurchey                    

jasonlane

  • Member
  • **
  • Posts: 743
  • Kudos: 0
    • http://www.root10.net
Java question
« Reply #9 on: 15 October 2003, 21:44 »
You may want to look into JINI / Java Web Start, it may not be what your looking for. Hope it helps though   ;)  

Web Start
The MES Anti-Prude Force
*******
"I don

flap

  • Member
  • **
  • Posts: 1,268
  • Kudos: 137
Java question
« Reply #10 on: 15 October 2003, 21:53 »
quote:
Because there are applications written by Sun in Java that runs in Windows


I'm assuming they use some kind of native windows exe as a wrapper.
"While envisaging the destruction of imperialism, it is necessary to identify its head, which is none other than the United States of America." - Ernesto Che Guevara

http://counterpunch.org
http://globalresearch.ca


fmrmicroserfunemployed

  • Newbie
  • *
  • Posts: 6
  • Kudos: 0
Java question
« Reply #11 on: 17 October 2003, 02:47 »
Dude,

  You can compile to exe with Java. gcc, gck.
 
  You can probably use "start" or "call" DOS command line shell commands with some options to hide that nasty DOS window in the background.

   You can write a really quick C++ or VB to use Exec   /exec (C/vb) or CreateProcess to fire it up with whatever windows show/hide, min/max you want.

Cheers!  :eek:
How can we remain free?

Xeen

  • VIP
  • Member
  • ***
  • Posts: 1,065
  • Kudos: 55
Java question
« Reply #12 on: 17 October 2003, 03:00 »
quote:
Originally posted by HadJobBeforeMSFTnIndia:
Dude,

  You can compile to exe with Java. gcc, gck.
 
  You can probably use "start" or "call" DOS command line shell commands with some options to hide that nasty DOS window in the background.

   You can write a really quick C++ or VB to use Exec   /exec (C/vb) or CreateProcess to fire it up with whatever windows show/hide, min/max you want.

Cheers!   :eek:  



Can you explain in more detail?

xyle_one

  • VIP
  • Member
  • ***
  • Posts: 2,213
  • Kudos: 135
Java question
« Reply #13 on: 30 October 2003, 04:23 »
itm

badkarma

  • VIP
  • Member
  • ***
  • Posts: 497
  • Kudos: 0
Java question
« Reply #14 on: 30 October 2003, 21:35 »
The mentioned methods have a few drawbacks:

 
quote:
You can probably use "start" or "call" DOS command line shell commands with some options to hide that nasty DOS window in the background.



Using javaw instead of java to launch your java program solves this, but the windows task list (or *nix process list) will still show the nondescriptive javaw.exe as the running process, which isn't very nice.

 
quote:

 You can write a really quick C++ or VB to use Exec /exec (C/vb) or CreateProcess to fire it up with whatever windows show/hide, min/max you want.



I'm not very familiar with the windows API (read: not at all) but I think exec and createprocess will spawn new processes and generate additional entries in your task list (ofcourse I could be entirely wrong here   )

However, there is another option (the one I chose when I was messing around with this) which is to use JNI (java native interface) to spawn a java vm and pass your class files to it. However, you will still need a jre installed for the program to run and sun's binary license prevents you from just including the needed files and not the whole JRE. (I might have the code I wrote lying around, it's ugly but it works)

If you want a "native" executable (ie. no VM required) you're out of luck (unless you're willing to spend at least a few hundred dollars) because gcj's (gcc for java) AWT implementation is shoddy at best with lots of unsupported stuff.
If you can't learn to do something well, learn to enjoy doing it poorly.