Compiling in MSDOS Prompt
Good Afternoon,
Below is the error I have recieved.
C:/javac Count.java
'javac' is not reconginezed as an internal or external command,
operable program or batch file.
I know some people have asked this before but the answers did not help me.
I have J2SdK1.4.2_05. I am using windows 2000 Professional.
I have javac.exe so when I type
C:/j2sdk1.4.2_05/bin> javac Count.java
error: cannot read: Count.java
1error
I need to know how to permetally set the path and how to make this program load.
Thank you in advance,
Adver
Sorry I spoke to soon can someone help me with this error?
C:\>javac Count.java
Count.java:8: class ContinueTest is public, should be declared in a file named C
ontinueTest.java
public class ContinueTest{
^
1 error
This is the program I am trying to compile
import javax.swing.JOptionPane;
public class ContinueTest{
public static void main(String args[]) {
String output = "";
for ( int count = 1; count <= 10; count++ ) {
if ( count != 5 ) continue;
output += count + " ";
} // end for
output += "\nRemoved continue to skip printing 5";
JOptionPane.showMessageDialog( null, output );
System.exit(0);
Thank you in advance.
Similar Messages
-
Opening Java folder in MSDOS prompt
This is what happens when I try to open my Java folder in MSDOS prompt. Could somebody plese help me?
C:\WINDOWS>Java
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertionsWait forget that last post it was wrong. Thanks for
all your help everybody but could you please help me
with this problem: Right now i am as far as getting
the directory open, I tried opening the HelloWorldApp
both ways that it said in the tutorial called "Your
first cup of Java" and this is what happens:
Volume Serial Number is 4CF6-6CC4
Directory of C:\WINDOWS\JAVA
. <DIR> 10-13-98 11:52p .
.. <DIR> 10-13-98 11:52p ..
CLASSES <DIR> 10-13-98 11:52p CLASSES
PACKAGES <DIR> 10-14-98 12:05a Packages
LIB <DIR> 06-11-99 5:04p lib
NANO <DIR> 06-11-99 5:05p nano
HELLOW~1 TXT 289 07-22-02 6:51p
HelloWorldApp.java.txt
HELLOW~1 JAV 292 07-23-02 4:35p
HelloWorldApp.java
HELLOW~2 TXT 289 07-23-02 4:56p
HelloWorldApp2.java.txt
3 file(s) 870 bytes
6 dir(s) 2,101.69 MB free
C:\WINDOWS\JAVA>HelloWorldApp.java.txt
Bad command or file name
C:\WINDOWS\JAVA>HelloWorldApp.java
Bad command or file name
C:\WINDOWS\JAVA>C:\jdk1.4\bin\javac
HelloWorldApp.java
Bad command or file name
Make sure the path for javac is right, other than that it looks fine -
Not able to compile from command prompt
Hi,
I have a javafx class which calls java object. I'm able to compile project from NetBeans but not from command prompt.
When i compile from command prompt compiler shows error saying it can not identify symbol (treats java class name as symbol).
I have already compiled my java class, and is in same dir as my java fx class.
Any reason for such beahviour?? and some solution plsssimport java.lang.Math;
import javafx.application.*;
import javafx.input.*;
import javafx.scene.*;
import java.lang.System;
import com.sun.javafx.runtime.sequence.*;
import java.util.Iterator;
import dekoh.photo.command.ImageService;
public class ImageRotater extends CustomNode{
public attribute image: Image;
public attribute x: Number;
public attribute y: Number;
public attribute angle: Number;
private attribute startX: Number = 0.0;
private attribute startY: Number = 0.0;
private attribute startA: Number = 0.0;
private attribute moverOpacity: Number;
private attribute rotatorOpacity: Number;
private function toggle(mo:Boolean, ro:Boolean): Void {
moverOpacity = if (mo) 0.5 else 0.0;
rotatorOpacity = if (ro) 0.5 else 0.0;
public function create(): Node {
var cx = image.width / 2.0;
var cy = image.height / 2.0;
var mover = Circle {
cursor: Cursor.CROSSHAIR,
radius: 20,
centerX: cx, centerY: cy,
anchorX: bind x + cx,
anchorY: bind y + cy,
fill: bind Color.rgb(200, 200, 255, moverOpacity),
onMouseMoved: function(e:MouseEvent):Void {
toggle(true,false);
onMouseExited: function(e:MouseEvent):Void {
toggle(false,false);
onMousePressed: function(e:MouseEvent):Void {
toggle(true,false);
startX = e.getStageX();
startY = e.getStageY();
onMouseDragged: function(e:MouseEvent):Void {
toggle(true,false);
x = x + e.getStageX() - startX;
y = y + e.getStageY() - startY;
startX = e.getStageX();
startY = e.getStageY();
var rotator = ShapeSubtract {
cursor: Cursor.HAND,
fill: bind Color.rgb(200, 200, 255, rotatorOpacity),
onMouseExited: function(e:MouseEvent):Void {
toggle(false,false);
a: Circle {
centerX: cx, centerY: cy, radius: mover.radius * 3.0,
b: Circle {
centerX: cx, centerY: cy, radius: mover.radius,
var border = Rectangle{
width: image.width, height: image.height
arcWidth: 20, arcHeight: 20,
return Group {
anchorX: cx, anchorY: cy,
rotate: bind angle,
translateX: bind x,
translateY: bind y,
content: [ ImageView {
clip: border,
image: image, clipAntialiased: true,
}, DelegateShape {
shape: border,
stroke: Color.rgb(200, 200, 200, 1.0), strokeWidth: 4,
}, rotator, mover ]
var contents:ImageRotater[] = [];
var i = 0;
var urls = ImageService.getUrlList(); // calling static method of java class
var j=0;
while(j<urls.size()){
var img:Images = urls.get(j) as Images; // another java class.
var imgRot = ImageRotater {
image: Image { url: img.getUrl() },
x:img.getX(), y:img.getY(), angle:90
insert imgRot into contents;
j++;
Frame {
title: "JavaFX"
width: 1080, height: 480
visible: true
closeAction: function() {
java.lang.System.exit(0);
stage: Stage {
fill: null
content: contents
On Compiling from command prompt
F:\dekohv6\butterfly\installer\samples\picApp\src\dekoh\photo\command>javafxc ImageRotater.fx
ImageRotater.fx:17: cannot find symbol
symbol : class ImageService
location: package dekoh.photo.command
import dekoh.photo.command.ImageService;
^
ImageRotater.fx:115: cannot find symbol
symbol : variable ImageService
location: class dekoh.photo.command.ImageRotater
var urls = ImageService.getUrlList();
^
ImageRotater.fx:118: cannot find symbol
symbol : variable Images
location: class dekoh.photo.command.ImageRotater
var img:Images = urls.get(j) as Images;
^
ImageRotater.fx:118: cannot find symbol
symbol : variable Images
location: class dekoh.photo.command.ImageRotater
var img:Images = urls.get(j) as Images;
^ -
-Xlint warning when compiling with command prompt.
1 of the method i write in the program has a compilation warning when compiling with command prompt. When i compile the codes with the application i used to write the program has no error at all. Below is my code:
private static ArrayList readNum(String NumFile)
ArrayList key = new ArrayList();
String keyAttributes = readInput(NumFile);
StringTokenizer stk = new StringTokenizer(keyAttributes);
while(stk.hasMoreTokens())
key.add(stk.nextToken());
return key;
When i javac the program with -X;int, this errror occured:
warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList
key.add(stk.nextToken());
^
1 warning
Anyidea how to solve this problem? Thanks for the help.A quick google for that message would have told you that you're not using generics and the compiler complains about that.
Google for "Java Generics" to find out what all the fuss is about. -
Compiling at DOS prompt?
When compiling at the DOS prompt one gets an error because one can only use 3 letter extensions unlike what is needed for "javac simple.java" and "java simple.class"
One does? I suppose if you had DOS 6.0 without Windows you would have this problem... is that what you have?
-
New to Java cant get it to compile in msDOS
Using SDK java 2 version 1.4.0. Checked my personal Computer folder types.
In folders in windows 98 do java file types open with javac.exe or java.exe? Tried both. When I try to compile a simple tutorial HelloWorldApp.java , it gives me a message that javac cant read it. The path is OK on MS DOS since it recognizes the javac command. I should be having no problems with tutorial. Did I mess up the links to the class and java file types ?. Microsoft tech support fixed a problem when I opened some demo files into the wrong programs and it was permanent.Then I tried to reset the right exe files to go with the file types but I am not sure. I have tried re downloading the software several times. Should I buy a sun software or are these downloads bad?use javac to compile java programs.
e.g.
javac HelloWorld.java
use java to run compiled code (class files)
java HelloWorld
(Don't include the extension .class when using the java command) -
Error while compiling java file using J2SE 1.5.0
Dear Sir,
I'm getting the following error while compiling the java file.The code is also given.
package test;
public class TestRowSet {
public TestRowSet() {
"TestRowSet.java": cannot access java.lang.Object,bad class file: D:\Program Files\Java\jdk1.5.0\jre\lib\rt.jar\java\lang\Object.class,class file has wrong version 49.0, should be 48.0,Please remove or make sure it appears in the correct subdirectory of the classpath. at line 4, column 1
Please help me out.
--Suketu Naik.But I'm compiling within "Borland JBuilder 9.0". I've
set the JDK path of the current project to point to
the path of JDK 1.5.0 . I've also tried to compile at
command prompt with "javac". I'm getting the same
error of "Undefinedclassloader" with long StatckTrace.
I don't know anything about JBuilder either. If you use the command prompt and enter the full path to the 1.5 javac.exe then that will prove whether the issue is using an older javac or not. For example "c:\j2sdk1.5.0_01\bin\javac HelloWorld.java" -
Aspnet_compiler: Command Prompt error
Hello
I am getting the following error when trying to compile my ASP.NET project from the Command Prompt:
error 1001: Unexpected parameter: 'Studio'.
The compiler on my hard drive is here:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319, although I do have another folder here:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
There is an aspnet_compiler.exe in both of those 'framework' folders.
Having located the compiler in command prompt on that path above, I now need to compile my files (aspx.aspx.vb, and Web.config) in accordance with the guidelines here:
http://msdn.microsoft.com/en-us/library/ms229863.aspx
I create a targetDir on my PC as follows: C:\myForm, and type in the location of my project in Command Prompt. This is a
physical path so I use '-p' and I wish the file to be updateable so I use '-u'.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_compiler C:\Users\Steve\Documents\Visual Studio 2013\WebSites\WebSite10 -p -u C:\myForm
This 'Visual Studio 2013' looks suspicious because of the spaces but if I right-click on the folder containing the project itself and select properties, this is what the path looks like:
C:\Users\Steve\Documents\Visual Studio 2013\WebSites
What am I doing wrong, please?
Thank you.Hi,
I'm not familiar with Aspnet_compiler.exe tool. However, I think the path must be in double quotes if you use "-p".
Like:
Aspnet_compiler -v /WebApplication1 -p "c:\Documents and Settings\Default\My Documents\MyWebApplications\WebApplication1" -keyfile "c:\Documents and Settings\Default\My Documents\Key.sn" -aptca c:\applicationTarget
What's more, it looks like you didn't post in a correct forum. You need to reopen a new thread in
asp.net forum because we can't help move this issue there.
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Compile Error Statement is not accessible
Hi All,
I have report in SAP 4.7 . when i do syntax check on it it give a warning -"statement is not accessible."
But same thing when we compile we are getting as Syntax error in ECC 6.0 .
when I compile it, it prompts
<i><b>Include ZHRIPENR
Statement is not accessible.</b></i>
<i><b>My REPORT program -</b></i>
REPORT ZHRIBANK NO STANDARD PAGE HEADING
LINE-SIZE 80
LINE-COUNT 65.
START-OF-SELECTION.
INCLUDE ZHRIPENR.
END-OF-SELECTION.
<i><b>My INCLUDE program -</b></i>
*INCLUDE ZHRIPENR.
PERFORM BATCH_INIT.
FORM BATCH_INIT.
ENDFORM. " (BATCH_INIT)
when I compile it, it prompts
<i><b>Include ZHRIPENR
Statement is not accessible.</b></i>
Please let me know how can i proceed .
Cheers,
ReddyHi ..
The Reason may be bcoz you are Placing the FORM statements inside the Include.
Just Remove the FORMS from the Include and Place the in ur Main program in the Last.
Note: Subroutine definitions has to be in the end of the code.
REWARD IF HELPFUL. -
Compile questions about example " DrawTest.java"
i install the j2sdk1.4.0 with windows98 operations system.
i want to recomplie the examples in c:\j2sdk1.4.0\demo\applets\DrawTest
javac DrawTest.java
12 errors occur as following:
DrawTest.java:185: cannot resolve symbol
symbol : variable orange
location: class Color
b.setForeground(Color.orange);
^
DrawTest.java:188: cannot resolve symbol
symbol : variable black
location: class Color
b.setForeground(Color.black);
^
DrawTest.java:194: cannot resolve symbol
symbol : variable lightGray
location: class Color
shapes.setBackground(Color.lightGray);
^
DrawTest.java:200: cannot resolve symbol
symbol : variable lightGray
location: class Color
g.setColor(Color.lightGray);
^
12 errors
how to solve this problem?
thanks a lotNormally problems regarding cannot resolve symbol I've found are because the file you're working on uses another class file in the code, and the compiler from the prompt doesn't know where it's looking for the dependant classes. When compiling try using "javac -classpath "c:\whereyourclassesare" "c:\whereyourjavafileis.java""
That should work, hopefully :) -
REUSE SETTINGS supresses error messages when compiling an invalid object
Hello,
my test:
Create a table and a packaged procedure referencing the table. Then drop the table and recompile the package:
CREATE TABLE x (
y NUMBER
CREATE OR REPLACE PACKAGE y
AS
PROCEDURE z;
END y;
SHOW ERRORS
CREATE OR REPLACE PACKAGE BODY y
AS
PROCEDURE z
IS
v_count PLS_INTEGER;
BEGIN
SELECT COUNT(*)
INTO v_count
FROM x;
END z;
END y;
SHOW ERRORS
DROP TABLE x;
PROMPT 1.Compile package
ALTER PACKAGE y COMPILE;
SHOW ERRORS
PROMPT 2.Compile package body
ALTER PACKAGE y COMPILE BODY;
SHOW ERRORS
PROMPT 3.Compile package with "REUSE SETTINGS"
ALTER PACKAGE y COMPILE REUSE SETTINGS;
SHOW ERRORS
PROMPT 4.Compile package body with "REUSE SETTINGS"
ALTER PACKAGE y COMPILE BODY REUSE SETTINGS;
SHOW ERRORS
SELECT object_name
,object_type
FROM user_objects
WHERE status = 'INVALID';
--DROP PACKAGE y;Partly unexpected output
Tabelle wurde erstellt.
Package wurde erstellt.
Keine Fehler.
Package Body wurde erstellt.
Keine Fehler.
Tabelle wurde gelöscht.
1.Compile package
Warnung: Paket wurde mit Kompilierungsfehlern geõndert.
Keine Fehler.
2.Compile package body
Warnung: Paketrumpf wurde mit Kompilierungsfehlern geõndert.
Fehler bei PACKAGE BODY Y:
LINE/COL ERROR
8/3 PL/SQL: SQL Statement ignored
10/8 PL/SQL: ORA-04044: procedure, function, package, or type is not
allowed here
3.Compile package with "REUSE SETTINGS"
Warnung: Paket wurde mit Kompilierungsfehlern geõndert.
Keine Fehler.
4.Compile package body with "REUSE SETTINGS"
Warnung: Paketrumpf wurde mit Kompilierungsfehlern geõndert.
Keine Fehler.
OBJECT_NAME OBJECT_TYPE
Y PACKAGE BODY
1 Zeile wurde ausgewõhlt.It says
- Table created
- Package created
- Package body created
- Table dropped
- Package header compiled with errors (why?)
- Package body compiled with errors (shown error is expected)
- Package header compiled with errors (again why?)
- Package body compiled with errors (no errors shown)
So why is the header compiled with errors, when the object is valid.
And why is no error shown for COMPILE REUSE SETTINGS when there are errors for the body?
I use REUSE SETTINGS when recompiling invalid objects that were compiled for debug with
ALTER PACKAGE abc COMPILE PLSQL_DEBUG = TRUE REUSE SETTINGSRegards
Marcus
Version:
SQL*Plus: Release 10.2.0.1.0 - Production on Di Jan 27 12:45:20 2009
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining optionsHi,
From SQL Reference Manual [REUSE SETTINGS|http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_1007.htm#BGBGEIGD]:
Specify REUSE SETTINGS to prevent Oracle from dropping and reacquiring compiler switch settings. With this clause, Oracle preserves the existing settings and uses them for the recompilation of any parameters for which values are not specified elsewhere in this statement.
For backward compatibility, Oracle Database sets the persistently stored value of the PLSQL_COMPILER_FLAGS initialization parameter to reflect the values of the PLSQL_CODE_TYPE and PLSQL_DEBUG parameters that result from this statement.
Regards, -
I have written a small sample code with 2 classes(Money.java and MoreMoney.java),where the latter has the main function. The problem is i cant compile and run these programs using commmand prompt in windows but they work just fine when using netbeans.
Env. variable is not a problem as money.java compiles using command prompt. Importing is not an issue as they are in the same package. Nor is package an issue, coz i have written the package name at the start of the code. Please suggest.Thank you in advance.
The code is as follows:
* Money.java
* Created on August 8, 2006, 11:09 AM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package javaapplication1;
* @author oracle
public class Money
private float amount;
private int dollars;
private float cents;
public Money(int amount)
dollars=amount/100;
cents=amount%100;
public float getdollar()
return this.dollars;
public float getcents()
return this.cents;
public String toString()
return("You Entered "+dollars+" dollars and "+cents+" cents");
* MoreMoney.java
* Created on August 1, 2006, 5:36 PM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package javaapplication1;
* @author oracle
public class MoreMoney
* @param args the command line arguments
public static void main(String[] args)
// TODO code application logic here
Money m=new Money(143);
System.out.println(m);
Any other tips on my code are also welcome since i am new to java and would like to learn good 'coding habits'.Hello,
Thank you for the suggestion.
I already have my .class files & my .java files in the JavaApplication1 folder. I have done as instructed on the webpage (http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html#Environment) and also have set the environment variable, CLASSPATH to the value:
C:\Program Files\Java\jdk 1.5.0_07\bin\JavaApplication1\src\ JavaApplication1
When i say env. varible it is the 'systems variable' of the env. variable category. Am i correct on that one?
I have another piece of information. After setting the CLASSPATH to its new value and restarting command prompt, it did not automatically go to that directory/path. It instead gave me the default path(C:/Documetns and Settings/oracle>)
I had to manually change the directory until i had the above mentioned path. Is there something fishy about my DOS-prompt or is that the way it is supposed to be?
So inspite all this experimentation the problem still persists. Why wont my code compile from DOS-Prompt? Thank you for your patience and please advice. -
Hi,
I am trying to complie my class directly on the server, which access an XMLParser class. When i am trying to do so. I am getting the following errors at the compile time:
error: Can't write: ./XMLParser.class
error: Can't write: ./XMLParser.class$XMLContentHandler.class
error: Can't write: ./XMLParser.class$ParserErrorHandler.class
error: Can't write: ./XMLParser.class$Storage.class
error: Can't write: ./XMLParser.class$XMLField.class
Any ideas..... thanks in advanceOkay, that throws out that...
have you tried to do it on any other computer? are you physically sitting next
to the server? Or using remove desktop? Compiling using command prompt javac or some IDE like eclipse? Trying to narrow down your problem(s)... -
Compiled successfully, but can't use java.exe
Hi all,
I could compile Hello.java with javac successfully, and the Hello.class was created. But when I run with java, it gave me an error :(
For example:
javac Hello.java
compiled successfully, Hello.class was created java Hello
gave me an error: Exception in thread "main" java.lang.NoClassDefFoundError: Hello
I'm sure the code was correct, because I could run it in BlueJ and JCreator. I just can't run it in command prompt. The .class was compiled in command prompt. So, why wouldn't java.exe work in the command prompt?
ThanksThe earlier post is correct - the problem is the classpath.
Change to the directory that contains Hello.java and verify that it exists and is correctly named. Then use this command:
java -classpath . Hello
IMPORTANT: include the period and the surrounding spaces.
Learn about finding classes and setting the classpath here:
http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#general -
Hi,
I�am only new to the J2EE platform but have experience with J2SE. I have installed J2EE 1.4 and Tomcat server 5.0.28 to study for the Web Component Developer Exam.
When I go to compile my java files, the compiler doesn�t not recognise the J2EE parts of the file. I have imported the correct classes (even the import statements, it doesn�t recognise!) and when I compile, the errors are associated with J2EE classes (i.e. doesn�t recognise HttpServlet....)
I compile in command prompt by typing: javac myFile.java.
I am aware that the file servlet-api.jar is required for these J2EE extras when compiling and I think this is my problem. I have put the location of this file on my classpath (set classpath=.;C:\fileDir\servlet-api.jar) by it still fails to compile. I have also put this location of the file directly into my PATH by this doesnt help!
Can anybody help me out with this configuration problem?
Thanks very much for any help!You need to have j2ee.jar (which can be found in <j2ee_install_dir>/lib directory in your classpath in order to successfully compile.
Maybe you are looking for
-
Error message of Excise invoice has no matchin lines while capturing excise
hi CIN gurus I ma facing a problem Whil capturing excise at depot. error message appearing as Excise invocie no matching lines. This problem occurs even after entering appropriate internal number in J1IG. And this problem is occuring randomly . This
-
Itunes no longer sees my iphone 4s as a device? What can i do?
-
Internet won't connect all of a sudden...
One night I was on my internet, watching a baseball game, and everything was working perfectly. Then the next morning, I went to open my internet and it wouldn't connect. I checked the other two computers in the house (that are using the same AirPort
-
Difference Between Flash Cs6 on Mac and on Windows.
I have a Mac and I am using Flash Professional Cs6 on it. I will have to use to on a Windows computer soon and i don't know whether it will be the same on that too. Can you please tell me what are differences in Flash Cs6 Mac version and Flash Cs6 Wi
-
I am a newb to the DBA side of Oracle and have never setup an instance of it or installed it for that matter. I have TOAD and I would like to connect to the server using it. I have installed TOAD 7.6 on my workstation and that is all. I have not inst