Netbeans on Windows - java

After programming on Mac for a while I tried to program on windows for a change. I started to program but soon realised, what ever I put, the result will not show. I tried the most basic code on netbeans which is,
public class NewClass {
public static void main(String[] args) {
System.out.println("Hello");
}
}
On my Macbook it would give me "Hello" but on my Windows it would give me,
"run: BUILD SUCCESSFUL (total time: 0 seconds)" with no Hello what
soever...

Related

Java in Classic ASP

Is it still possible to use Java in Classic ASP (IIS 7.* / Windows) via Java Moniker as is demonstrated at http://cephas.net/blog/2004/03/15/scripting-in-asp-with-java/? (and http://thrysoee.dk/InsideCOM+/ch11f.htm and https://hq.lojcomm.com.br/java/Interop.class.asp).
I cannot make it work from IIS 8.5 (or from dektop VbScript) in my Windows 10 with Java 1.8.0_131 installed in C:\Program Files\Java.
I get all the time: error'800401e4' with no other clarifications in the first line:
set Java_Date = getObject("java:java.util.Date")
response.write( Java_Date.toString() )
and the same error comes if I try to use NetBeans-compiled custom class:
set Java_Greeter = getObject("java:omatestit.Hello")
public class Hello
{
public static void main(String[] args)
{
//do nothing - this will keep us from getting a compile error
}
public String SayHello()
{
return "Hello Geek";
}
}
which locates in:
"C:\Program Files\Java\jdk1.8.0_131\include\win32\TrustLib\omatestit\Hello.class"
Can anyone figure out what is wrong with previous settings?

Tell if java application is running with nt authority/system privilege

I'm trying to get the username on Windows
public class Foo {
public static void main(String[] args) {
System.out.println(System.getProperty("user.name"));
}
}
It works with normal users, but when I do it with system account,
The value was different from the output of whoami command
Any ideas? I need to get the correct name with Java, and it's best without dependency jars
P.S I'm running CMD on a Windows 2008 R2 box

Terminal loses focus on Mac OS X when calling java.awt.Color.*

I'm writing a command line program in java, and using java.awt.Color for utility purposes (there is no GUI involved). But when I reference java.awt.Color.RED (for instance) it causes the terminal to lose focus. This only happens on Mac, it works fine on Linux and Windows. I suspect that the static initializers are the problem, but I'm not really sure where to go from here, as this is not a problem that I can debug (since the problem isn't going to happen if the terminal doesn't have focus to begin with).
Here is a small code snippet that demonstrates the problem. (Build the jar, then run it from the terminal.)
public class Sandbox {
public static void main(String[] args) throws Exception {
System.out.println("Note that we have focus right now. Calling System.out.println(Color.RED) in 5 seconds.");
Thread.sleep(5000);
System.out.println(java.awt.Color.RED);
System.out.println("Note now that focus has been lost.");
Thread.sleep(5000);
System.out.println("Ending program.");
}
}

No GUI opens when run

Out of nowhere when I run my application no GUI pops up only says BUILD SUCCESSFUL (total time: 1 second) in the console, don't know why it happened or if anyone has had this before? Tried restarting netbeans etc ill post my code below incase its that. And it was working at one point.
pastebin(dot)com/XvD30sCP code is here
public static void main(String args[]) {
global_crime gc = new global_crime();
gc.setVisible(true);
}
Add this... it will work now..

How can I see the output console result in Netbeans?

I am a beginner studying Java using NetBeans. I created my first class and some simple code:
public class suju {
public static void main(String[] args){
System.out.print("hello word");
}
}
Why don't I see any result when I click run? I am supposed to see hello world but nothing like this is shown.
Only a message BUILD SUCCESSFUL (total time: 0 seconds)
Unfortunately, I can't post images yet to better present the problem I am facing.
Try to right click on the class file on the left panel then choose run option
Mine was doing the same.
I went to java.com and downloaded java again- it then prompted me to uninstall all out-if-date updates.
When I ran it again it was working.

Categories