Can I run my java program in windows environment?
How can i make my compiled java program run into windows environment?
What program will i use to be able to do that?
1. Install the JRE.
2. Go to the command line.
3. Type something like java myClass or java -jar myJar.jar.
You could also use one of the many java2exe (java to executable) programs floating out there.
Similar Messages
-
I want to run java program on windows environment as background process
Hi all
I want to run java program on windows environment as background processSo command prompt return after executing java command and program on background In Linux we can do this easily �but I do not how to do this in windows
for example look this programe
import java.io.*;
import java.util.*;
public class TestClass {
class ravi extends Thread{
public void run(){
try {
String target_file = "ravind.txt";
File targetfile = new File(target_file);
PrintWriter writer = new PrintWriter(new FileWriter(targetfile)) ;
for (int i =0 ; i < 100 ;i++ ){
Thread.sleep(10000);
writer.println(" ravindra shukla ");
} catch (Exception e) {
e.printStackTrace();
public static void main(String[] args) {
TestClass test1 = new TestClass();
TestClass.ravi r1 = test1.new ravi();
r1.start();
System.out.println(" return from main ");
first i compile this
javac TestClass.java
then i run this by using this command
java TestClass
but becouse i put sleep on threads run function so it takes to much time to get return on command promt .... i want to run this programe as background process so command promt return as soon as i execute java commandThanks dude
This solution �start java TestClass� works fine �. But it does not solve my problem
It opens another black window and that black window persist till the life time of my program
Is it possible application run on complete background without opening another black window �as in Linux -
How can i run my java program with out java language
Hai to every one ..Iam new to java language ...am using windows xp operating system , i did not installed java language in my system .. how can i run a java program with out installing java language... Which files is requied to run java program..?
any one can help me??Hai to every one ..Iam new to java language ...am
using windows xp operating system , i did not
installed java language in my system .. how can i run
a java program with out installing java language...
you ... can ... not ... do ... this
Which files is requied to run java program..?
any one can help me??a JVM. Download it from sun's website.
[url http://java.sun.com/javase/downloads/index.jsp]Download JavaSE here -
How to run a java program in windows 2003 server from unix server.
Hi ,
I want to run a java program in windows 2003 server from unix machine ..
will RMI helps me to obtain this.
Please tell me the procedure to do this.
Thanks in advance,rmi,web services,corba,web 2.0,xml,xls,dtd,rss,ruby on rails,https,soap,tags,blog,podcast,google
-
How can i run my java program in background process?
hi all,
i am working on desktop monitoring so when i start my program on client machine that is visible to all but i want this program client not visible to all instead of this can be run in background process . so, nobody can see that.
so, how i can do this ?
pls pls help me
thanks in advanced to helper
regards
maulik & riteshthis will run the java program in the background.It'll just use the Windows Java Console instead of the command-line console. It has nothing to do with running as a background process.
Edit: though this might be exactly what the OP wants: not "background process" but "no DOS console". -
To run a java program on windows xp startup
hi ,
i have a sample HelloWorld.java program.
i wrote a batch file to run this program as follows:
set PATH=%PATH%;C:\Program Files\Java\jre1.6.0\bin;
cd c:\test
java HelloWorld
This program runs when i click on the bat file.
Next i add this batch file to registry to auto-start on windows startup
However, on windows startup, i get the following:
Exception in thread "main" java.lang.NoClassDefFoundError
Anyone can help me? Thank you in advance!Hi Sergi,
Thanks for the info. I couldn't able to login because of my internet connection.
Thanks,
--Srini -
How can I run a java program on Linux?
I have JBuilder's IDE installed on my Linux partition and it works. However I don't know how to compile and test a program without it. Also I tried to install Limewire on Linux and although I've installed the Java SDK on the system. Once before I installed JBuilder and then JBuilder (I guess) installed it again. However it told me it couldn't find the Java Virtual Machine. Isn't this installed with the JDK? I am able to run programs through JBuilder so I can't see why I'd have a problem. Any answers to the above issues would be greatly appreciated.
Go here and work out how to make a simple app to compile and run on the command line: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/unix.html#2b
(You should find the JDK from a directory under the jbuilder directory so use that and not the /usr/local/jdk1.4 in the example.)
Then find the classes or source code of your project and do the same thing to it. -
I installed J2SE v 1.4.2_04 SDK on my computer.
I'm using textpad to write my programs. After i'm done writing my programs in can compile them on textpad and javac in command prompt. But when i try to run my program using java HelloWorld and textpad I get this error...
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld .
And the program in just a simple helloworld progam.
Can anybody help me please?Search the forum for "classpath"
-
How can I run this java program? Please help.
I have jmf installed, sunone running , the file may be in the wrong directory.
It is in some directory nowhere near the java lang dir.
When I try to compile or build i cant. I'm off on a basic thing.
here is the code.
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiDevice;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Receiver;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.ShortMessage;
import javax.sound.midi.SysexMessage;
public class MidiNote
/** Flag for debugging messages.
If true, some messages are dumped to the console
during operation.
private static boolean DEBUG = false;
public static void main(String[] args)
try {
// TODO: make settable via command line
int nChannel = 0;
int nKey = 0; // MIDI key number
int nVelocity = 0;
* Time between note on and note off event in
* milliseconds. Note that on most systems, the
* best resolution you can expect are 10 ms.
int nDuration = 0;
int nArgumentIndexOffset = 0;
String strDeviceName = null;
if (args.length == 4)
strDeviceName = args[0];
nArgumentIndexOffset = 1;
else if (args.length == 3)
nArgumentIndexOffset = 0;
else
printUsageAndExit();
nKey = Integer.parseInt(args[0 + nArgumentIndexOffset]);
nKey = Math.min(127, Math.max(0, nKey));
nVelocity = Integer.parseInt(args[1 + nArgumentIndexOffset]);
nVelocity = Math.min(127, Math.max(0, nVelocity));
nDuration = Integer.parseInt(args[2 + nArgumentIndexOffset]);
nDuration = Math.max(0, nDuration);
MidiDevice outputDevice = null;
Receiver receiver = null;
if (strDeviceName != null)
MidiDevice.Info info = getMidiDeviceInfo(strDeviceName, true);
if (info == null)
out("no device info found for name " + strDeviceName);
System.exit(1);
try
outputDevice = MidiSystem.getMidiDevice(info);
outputDevice.open();
catch (MidiUnavailableException e)
if (DEBUG) { out(e); }
if (outputDevice == null)
out("wasn't able to retrieve MidiDevice");
System.exit(1);
try
receiver = outputDevice.getReceiver();
catch (MidiUnavailableException e)
if (DEBUG) { out(e); }
else
/* We retrieve a Receiver for the default
MidiDevice.
try
receiver = MidiSystem.getReceiver();
catch (MidiUnavailableException e)
if (DEBUG) { out(e); }
if (receiver == null)
out("wasn't able to retrieve Receiver");
System.exit(1);
/* Here, we prepare the MIDI messages to send.
Obviously, one is for turning the key on and
one for turning it off.
MidiMessage onMessage = null;
MidiMessage offMessage = null;
try
onMessage = new ShortMessage();
offMessage = new ShortMessage();
((ShortMessage) onMessage).setMessage(ShortMessage.NOTE_ON, nChannel, nKey, nVelocity);
((ShortMessage) offMessage).setMessage(ShortMessage.NOTE_OFF, nChannel, nKey);
/* test for SysEx messages */
//byte[] data = { (byte) 0xF0, (byte) 0xF7, (byte) 0x99, 0x40, 0x7F, 0x40, 0x00 };
//onMessage = new SysexMessage();
//offMessage = new SysexMessage();
//onMessage.setMessage(data, data.length);
//offMessage = (SysexMessage) onMessage.clone();
catch (InvalidMidiDataException e)
if (DEBUG) { out(e); }
* Turn the note on
receiver.send(onMessage, -1);
* Wait for the specified amount of time
* (the duration of the note).
try
Thread.sleep(nDuration);
catch (InterruptedException e)
if (DEBUG) { out(e); }
* Turn the note off.
receiver.send(offMessage, -1);
* Clean up.
receiver.close();
if (outputDevice != null)
outputDevice.close();
} catch (Throwable t) {
out(t);
System.exit(0);
private static void printUsageAndExit()
out("MidiNote: usage:");
out(" java MidiNote [<device name>] <note number> <velocity> <duration>");
out(" <device name>\toutput to named device");
out(" -D\tenables debugging output");
System.exit(1);
private static void listDevicesAndExit(boolean forInput, boolean forOutput) {
if (forInput && !forOutput) {
out("Available MIDI IN Devices:");
else if (!forInput && forOutput) {
out("Available MIDI OUT Devices:");
} else {
out("Available MIDI Devices:");
MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < aInfos.length; i++) {
try {
MidiDevice device = MidiSystem.getMidiDevice(aInfos);
boolean bAllowsInput = (device.getMaxTransmitters() != 0);
boolean bAllowsOutput = (device.getMaxReceivers() != 0);
if ((bAllowsInput && forInput) || (bAllowsOutput && forOutput)) {
out(""+i+" "
+(bAllowsInput?"IN ":" ")
+(bAllowsOutput?"OUT ":" ")
+aInfos[i].getName()+", "
+aInfos[i].getVendor()+", "
+aInfos[i].getVersion()+", "
+aInfos[i].getDescription());
catch (MidiUnavailableException e) {
// device is obviously not available...
if (aInfos.length == 0) {
out("[No devices available]");
System.exit(0);
e
* This method tries to return a MidiDevice.Info whose name
* matches the passed name. If no matching MidiDevice.Info is
* found, null is returned.
* If forOutput is true, then only output devices are searched,
* otherwise only input devices.
private static MidiDevice.Info getMidiDeviceInfo(String strDeviceName, boolean forOutput) {
MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < aInfos.length; i++) {
if (aInfos[i].getName().equals(strDeviceName)) {
try {
MidiDevice device = MidiSystem.getMidiDevice(aInfos[i]);
boolean bAllowsInput = (device.getMaxTransmitters() != 0);
boolean bAllowsOutput = (device.getMaxReceivers() != 0);
if ((bAllowsOutput && forOutput) || (bAllowsInput && !forOutput)) {
return aInfos[i];
} catch (MidiUnavailableException mue) {}
return null;
private static void out(String strMessage)
System.out.println(strMessage);
private static void out(Throwable t)
t.printStackTrace();Please post your code using code tags.
When I try to compile or build i cant.What is your question? Exactly what error message do you get? -
Opening a Word Document with a Java program in Windows
When running a Java program in Windows, is it possible to have a button where when it is clicked it will open a Word document?
If so, is it hard and can someone tell me how to do it??
Thankstry this instead of Excel.exe you have to use Word.exe
1. Declare your button
JButton butexlcom = new JButton("Carnet Offre");
butexlcom.addActionListener( new ButExlCommercial(msgout));
butexlcom.setBounds(215,510,110,30);
c.add( butexlcom );
2. run your word document.
class ButExlCommercial implements ActionListener {
private JTextArea msgout;
public ButExlCommercial( JTextArea msg) {
msgout = msg;
public void actionPerformed( ActionEvent e ) {
try {
Runtime.getRuntime().exec("c:\\Program Files\\Microsoft Office\\Office\\Excel.exe NameWordDocument");
catch(Exception en) {
msgout.append( "\n*** PROBLEME WORD ***\n" );
} -
How can I run a java-application on starting of Windows 2000
How can I run a java-application without any user on starting of Windows 2000?
For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
How can I do that?Hi, you have to put it in a Windows service.
To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
Regards,
Ivan. -
Can we run a java class in a external server through abap program?
Dear Experts,
Can we run a java class in an external server ( other than application server and client system )?
I have tried running it in the client system through a program and it works.
But i have the requirement of running it in another system. Can it be done?Hi,
If this is the case I think you can call this web service from SAP and triger the execution of the application on the "external server".
SAP is behaving as a client in this case.
Another alternative:
"have tried running it in the client system through a program and it works." please elaborate.
Regards. -
Can I write and run simple java programs in Xcode
I need to write and run basic java programs on my mac. I would like to run it in Xcode, but I don't know how to set it up? Is there a way?
Read the following discussion from last month on here:
Can Xcode 4.5.1 compile/run java? -
How can i run the java bean sample program download from OTN
hello to all
i have a p[roblem. i have downloaded the sample progam from oracle web site which is a java code that connect with the oracle and shows a form. how can i run the from.
can any body help me pleaSEEE
thanks
kamran ahmedHi Darryl.Burke
So your telling, we cannot run our Java Program when system shutdowns...In my application, when user has schedule for next days and he shutdown his PC. On the next day when System Started i should able to get back my schedule on the Specified time(I'm TimerTask class in Java)... How can i achieve this using Java? can u tell me clearly.. -
Running a java program from an icon
I want to run my program from an icon on my desktop. I have a .bat file that I've built a shortcut to and it works.MY GUI program does display and run when I click on the icon. The problem is that the DOS window also shows up behind my GUI.
Is there anyway to prevent the DOS window from showing? Or is there another way to run a Java program without resorting to a DOS command line or running it through FORTE or another IDD?Chris's solution worked well, with one small problem. Once my GUI starts, it takes up the whole screen. Normally when I run it, it appears as a small window.
not a big problem, I can reduce it easily after it starts. But does anyone know a way to make it come up in the reduced size it norally comes up in when I run it from my IDE?
Maybe you are looking for
-
My Passport for Mac originally worked and I was easily able to download files. It even worked on my MacBook Pro. Now, when I attach this external hard drive and open Finder, the external drive is not there. I've run Disk Utility. I've shut down, hit
-
My phone is only 7 months old and it will not hold a charge past 1%. It needs to be plugged in constantly, and I'm limited to iMessages only. No phone calls, or basic text messages.
-
I was recently... Uh.. Well I guesse the word would be "Forced" to upgrade my Pc to Vista after my old operating System (Windows XP ME 2002 edition) was no longer supported by Microsoft and the zune software. Basically It bricked my original Zune.
-
Am I in any way endangering my project if I use the mac for other functions like being online, receiving email, wordprocessing, etc, while my IDVD project is busy encoding assets, and getting ready to burn, or burning dvds? I ask because my experienc
-
Using BO PC 7.5 NW with Proxy
Hello everybody! Deos somebody know how to use BO PC 7.5 NW with a proxy server? When I try to connect the admin console with the bpc server i can trace a connection request directly to the bpc server and not to the proxy server. I know, in the insta