Question:
how to get textpad to compile and run java applications?
efrem s
2009-09-26 11:37:25 UTC
I am taking a java class and i got textpad but i can't get it to compile and run programs. which java do i download along with textpad and how do i properly install it?
Nine answers:
2009-09-26 11:51:52 UTC
Create your java program and save it.

Copy this source code file to bin folder of java (i.e where java is installed).

Then open up console window by going on START->RUN->type cmd->OK

A black console screen opens up.

With CD command enter into the bin directory of java folder like I had java 1.6.0_10 version so I will write



cd C:\program files\java\java1.6.0_10\bin

and press enter



after going into this directory write javac

i.e if my source code file name is firstprogram.java then I will write:

javac firstprogram.java ------- (this is called compiling a java code)



after then write:

java

like if I had created a class in my program which is firstprogram then I will write:

java firstprogram



and you'll find your program running



Do not try the IDE's on your first days of java program because you doesn't know how to run a code without the IDE you had. Most of the people face this Problem.
2014-05-15 09:32:28 UTC
Using set path in command prompt to compile & run java program. We use set path to set environment variable.



Just click on below link. You will get detail information regarding it.

http://marathaprogrammer.blogspot.in/2014/03/how-to-compile-run-java-program.html
2016-03-19 11:04:53 UTC
Are you sure you downloaded and installed the JDK and not the JRE? You're probably familiar, but the JRE is just the JVM runtime itself and doesn't include the java compiler, while the JDK includes the compiler, runtime, and more. I don't believe it's necessary to add or modify any environment variables, unless you want to compile and run java bytecode via command line. Lastly, if you're looking to compile and run java code within textpad, I might suggest using an actual IDE and something a bit more powerful like Eclipse or Netbeans (both of which are free).
Mark aka jack573
2009-09-29 22:57:22 UTC
I don't think TextPad allows you to compile and run the program inside it. You can only make the source (.java) file.



To compile the .java file you will need to open the command prompt. The easiest way is to go to the Start menu. Click on the Run... Type in cmd and press enter.



The command prompt will appear. Now you will have to change the directories to the directory (or folder) where you source (.java) file is. An easy way to do this is to open My Documents or Windows Explorer and go to the folder that your source file(s) is in. Then copy the address of the folder from the address bar towards the top of the window.



Then go back to the command prompt type in cd and a space after cd. The right click with the mouse and select paste. Then press return. You should be in the folder with your source files.



Now, you type

javac .java

to compile the program.

Then, type

java

to run the program.



For example, let's say you have a source file named HelloWorld.java, you would type

javac HelloWorld.java

and

java HelloWorld



BUT. Before you can do any of that, you will need to set up the classpath and path variables so windows can find the javac and java programs, and javac and java can find your source and compiled (.class) files.



This page will show you how to set up the path. This will allow you to use javac and java.

http://www.cs.colostate.edu/helpdocs/JavaPaths.html#XP



This page will show you how to set up the classpath, so javac and java can find your files.

http://faculty.ed.umuc.edu/~arnoldyl/NetBeansTutorials/Setting-Classpath.html



Now, you may need to know where you java is to be able to set the path.

:\Program Files\Java



Hope that helps you out.
The Teller
2009-09-26 11:45:20 UTC
Textpad sucks. Get a Java SDK and JRE off of the Sun Microsystems website (just search it up). Once you downloaded and installed those (install is not a literal term), you need a compiler. I'd recommend Eclipse for Java. It's fully featured, and free. Textpad is just if you are hopelessly incapable.
gaiacarra
2009-09-26 11:45:27 UTC
http://209.85.229.132/search?q=cache:tFcJ8NUNjjMJ:www.javafaq.nu/java-article785.html+textpad+compile+java&cd=4&hl=en&ct=clnk



(Using the cache because the regular page appears to be down).



Of course, you could also just download a dedicated Java IDE like NetBeans or Eclipse.
Andron Smith
2009-09-26 12:12:33 UTC
I just design my own TextEditor, and allow it to use external programs to compile the files. It's been my primary tool for programming since.



if you know visual basic or any other language good such as C++, design your own textpad. you'd be proud in the end.
Jeremy
2009-09-26 11:52:11 UTC
Don't. I'd use a good IDE like Netbeans or Eclipse.
The Black Tux
2009-09-26 11:45:30 UTC
Get eclipse...



command line:

javac command for compile

java for run in console

javaw for run as app


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...