Dear friends ,
I am new to java . I created an JFrame(Calculator) application in Netbeans.Now i want to run that file from console(putty) since i gonna use that .java class in some other program through which i want invoke this . How do i do this . When i try to run the java file directly it throws
"Bad file descriptor" error . Can any one help me

Recommended Answers

All 8 Replies

Sorry but you could not run the .java file. you should build the jar file from netBeans IDE and look to the out put. after building the jar the ouput will show you the command line to use.

You can also use the commande line to build the jar file if you want.

other solution for running a single file is to use the javac commande line to create a binary file with ".class" extension and then use java commande line witn the .class as argument.

Hope it helps.

Hello its possible to run when you create a java file in netBeans it creates a folder of that file. you will see a scr folder click on that inside u will see java folder where u can see your java file.so just open ur console give the path example "D:\data\src\java\yourjavafile.java" and you can run your java file.

In command prompt, point to the folder in which your java file exists. Now

c:\yourfolder> javac filename.java
c:\yourfolder> java filename

commented: a nut +0

r u a nut chirag.
have u ever used netbeans? i dont think so .

you r totally wrong.

Not sure wht's going on here, but DeadSoul's post (the first one, not the insult) is incomplete. His instrctions give you the .java file, but you need a .class or a .jar to run the program (just like chirag said).

r u a nut chirag.
have u ever used netbeans? i dont think so .

you r totally wrong.

No he is not wrong. He is absolutely right.
You cannot run a java file. When you click the run button at the NetBeans (something that anybody can do), Netbeans creates a jar file with all the classes of the projects and it runs the jar files.
Practically it runs the .class file.

> The original poster asked how to run the program from outside the Net Beans.
What if you make a program and want to run it to another computer? Will you carry the entire Net Beans installation with you.
Or do you think that if someone has a project and they want to run it, they open first the IDE, then load the source code and the click the run button. I am sure that nobody has ever thought something better.

Perhaps this:

c:\yourfolder> javac filename.java
c:\yourfolder> java filename

Now that is something that apparently not anybody can do

Dear friends ,
I am new to java . I created an JFrame(Calculator) application in Netbeans.Now i want to run that file from console(putty) since i gonna use that .java class in some other program through which i want invoke this . How do i do this . When i try to run the java file directly it throws
"Bad file descriptor" error . Can any one help me

Do you have the (JDK) installed on your computer? The (JDK) also has the (JRE) in it's package.

I'm sure you do just thought I would ask. Good luck!

@918_Nix please consider to check first date when post was created, then last date for reply and try not to reply to stuff that is too old (older then 6 months can be good measurement for start)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.