[Logo]
Forums Register Login
Java in Notepad++
Why can't I run JAva code in Notepad++. I followed this tutorial(http://www.quarkphysics.ca/scripsi/java_notepad/#part3) and I was able to compile but not run the program. Instead I get this strange error??



Full Error:


NPP_EXEC: "Java-run"
CD: F:\
Current directory: F:\
"\java\jdk1.8.0_66\bin\java" -classpath "F:\" "Draw4Ovals"
Process started >>>
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
<<< Process finished. (Exit code 1)
================ READY ================
can you post the error as actual text instead of a screencap? This a) allows me and other to read it, and b) allows the text to be searchable.
Avoid unusual means of executing code until you are more experienced. Use the command line as described for example in our FAQ. There is something not quite right about those scripts; they are probably very version‑specific and would need updating whenever a new version of Java® becomes available.
Assuming you do not have a package name in there which you haven't shown us (another risk of screenshots) you should be able to compile and run the code with
javac DrawOvals.java
java DrawOvals

There appears to be a discrepancy between the script they gave and your current Java® version.
javac... command obviously works but java command doesn't.
And what happens when you run the java command? Start with
java -version
javac -version

and tell us what the output for those two commands is.
Where should I type that in. I have no access to cmd (I am on a public computer).
I figured it out and it works now. The file has to be in a folder for example:
 
John Losty wrote:. . . I have no access to cmd (I am on a public computer).
Start→run→"cmd"?
I get a message: "you do not have the rights to use this program..." or something along those lines.
Damn! There is precious little you can do about that, short of buying your own computer. Or borrowing a friend's.
as I said before I can run Java on public computer. I solved the problem.

I already have my own computers.
 
John Losty wrote:I get a message: "you do not have the rights to use this program..." or something along those lines.


open notepad, type in it COMMAND.COM
-save it as a batch file *.bat

--have fun
Do you think that will actually work if the OP doesn't have access to the command line?
 
Campbell Ritchie wrote:Do you think that will actually work if the OP doesn't have access to the command line?


yes, i tried it.
 
Janko Livic wrote:open notepad, type in it COMMAND.COM
-save it as a batch file *.bat

This might work on a 32-bit Windows installation (as long as script processing is not also disabled), but will not work on 64-bit versions of Windows - they do not have the command.com executable.
A bit off topic, I fear, but I have a comment. I have used Notepad++ for various things for quite a while. It handles the line-ending problem handily for windows, at the very least. I like its multi-tab as well.

However, since switching to Windows 10, I have seen a problem where I cannot use its file-browse to open files. I can only open its previous state, or give it a command line args. Firefox does the same. And the problem appears to 'set in' after a couple of uses. Sometimes you can open a file or two before it happens. I do not know if this affects all 32-bit code or what. Of course, M$ own Edge works fine.

Has anyone else seen problems like this, and know the solution? It may be something I had installed prior to the upgrade, causing a conflict somewhere.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Jan 23, 2017 20:09:30.