My windows machine is at the tech support, meanwhile my substitute laptop is a macbook. I am not familiar with the system and I am having trouble to make Netbeans run java code.
If i try to import .zip java projects, it says "No Netbeans projects added".
When i look if i have a JDK in Tools --> java platforms I have default 1.8jdk
with a lot of files listed, so i do not think the JDK is the problem?
I downloaded netbeans with a JDK in a bundle as well.
I am unable to run any java code, the buttons are simply just grey instead of colored and if i try to use keyboard commands to make the laptop execute the code it comes with a error sound.
I read something about it could be ant variables, but not much information was given. But when i go tools --> ant variables it shows nothing.
When i try to create new files it only gives me two options: XML and other. In the other category there is; SQL, HTML and CSS. So no option for creating java files either.
Answers to comments:
I just trying deleting it at reinstalling from this domain http://www.oracle.com/technetwork/articles/javase/jdk-netbeans-jsp-142931.html
I cannot show you the command line, since i do not know the commands in Terminal. But in the JDK it says: /Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
I cannot run ANY java code, since I cannot create java files. If i try to run a simple program in an empty file I cannot run it.
Related
I think this stackoverflow question already has my answer: IntelliJ runnable jar doesn`t work on other computers
The answer on this question states that most IDEs can autoinclude the needed java libraries to make the jar runnable on pc's without jdk. My question is, where in IntelliJ can I make sure that these libraries are included?
In my project java 15 jdk already shows as external library: link to screenshot
This is what my artifact settings look like: link maybe I need to change something here?
Edit: My question is this: The jar file IntelliJ produces works fine on my computer. On my friends computer excecuting the file gives an JNI error. He only has JRE on his computer and not JDK. I am assuming the problem has something to do with this. How can I make sure the jar file runs on computers without JDK and with JRE?
Your program can run without the jdk but it will need a jre -- the Java Virtual Machine is needed.
You can create this on Java 11 and above using jlink which creates a custom cut-down Java runtime, along with your code, that can be executed on a different computer. However, it will have to be the same architecture/operating system; you can't run the Windows JVM on macOS or vice-versa, for example. Your application code, in the .jar, will be the same on both though.
I started to write code in Java few weeks ago. I use IntelliJ Idea (the latest version) on Win10x64.
I realized a little hangman game (as a Windows command line app) that uses a text file with the words and I have put this text file in a folder called 'assets' inside the project folder (at the same level of 'src' folder). The game works great in the IDE environment but I still don't know how to realize a standalone app and running it outside IntelliJ.
I tried also to compile from command line using javac.exe and it seems that compilation works well but when I try to execute the program from command line using java.exe I get an error that says that the text file I use as vocabulary is not found (java.nio.file.NoSuchFileException).
I have also followed the instructions on Jet Brains site about How to create a JAR file but with no results. Is there a simple way to deploy a Java desktop application so that people (who obviously have JRE) have just to make a double click on an icon and use it?
I have installed Netbeans 8.2 and jdk and jre 1.8.0_171. (Windows 10 OS; on a clean installation of the OS btw, just to eliminate possibility of corrupted registry keys, viruses etc).
I believe I have correctly set the system environment etc.
I created a HelloWorld file in notepad; compiled on cmd line, then when tried to run the file, I was asked as to what (default) program I wanted to use to run it.
When I went to associate netBeans I was unable to do so because it does not appear either in the menu, or in the control panel file association facility.
Even more odd, is when I went to check the registry,
Computer\HKEY_CLASSES_ROOT\Applications
netbeans was not there.....
Netbeans itself btw runs and works absolutely fine, so I am rather baffled by this....
Please advise
If you are running a Java application from the command line in Windows then you should be using java.exe to run it. NetBeans is an IDE, and while it does provide functionality to allow Java to be run internally (i.e From within NetBeans), that is very different to using NetBeans directly to run a Java application.
Furthermore, NetBeans does not use the Windows Registry for application registration, which is why you cannot associate NetBeans with any file type. Just because NetBeans can be installed as a Windows application does not mean that it is required to implement all the possible functionality of a Windows Application, such as file association.
It's also worth noting that the beta release of NetBeans 9 is only provided as a zip file, and its installation consists of nothing more than unzipping the dowloaded file to a folder, so it definitely does not use the Windows Registry.
I have an application that works fine and that I can execute from a .jar file. But I want to know how to make it runnable from any computer even if there is no JRE or the JRE version is not the good one. I thought about a .exe file but don't know how to do it.
I made my code with Eclipse and it use jxl,jdom and jfx librairies.
I tried to use Inno Setup 5.5.6 but when in Eclipse I run my build.xml as Ant Build it return me an error that says :
"'Launching JFX Build - Myapp' has encountered a problem.
The achive : C:/Program%20Files/eclipse/plugins/org.eclipse.swt.win32.win32.x86_64_3.104.0.v20150528.jar which is referenced by classpath, does not exist."
JavaFX provides specific utilities for bundling your application as a native package, which is referred to as "Self contained application packaging". These utilities are provided as a command-line tool, or as ant tasks. Additionally, the common IDEs support this via wizards, either out of the box (NetBeans) or via a plugin (e(fx)clipse for Eclipse). The details of how to use any of these are far beyond the scope of a stack overflow question, but the basic documentation is available here. A tutorial for e(fx)clipse is here.
Briefly, for e(fx)clipse, you should double-click the build.fxbuild file that is created in your project. Under the "Overview" tab, find the "Packaging format" option, and select "All" (or the specific type of package you want to create).
Note that you can only create a package targeted at the platform on which you are building, so if you want to create packages for windows, Mac, and Linux, you will need access to all three types of machine.
I know I am late. I faced same problem a trick worked for me. Look at the given directory in the error message. It contains a space (C:/Program Files/...). Move your e(fx)clipse to another directory where the directory doesn't contains any space.
Not sure it will work your everyone or not but it worked for me.
Thanks
There are various tools that let you wrap your Java application in a Windows executable. Some tools are only simple installers, others allow you to bundle your application with a specific JRE version.
A widely used but commercial tool is install4j, but there is a bunch of other tools, such as WinRun4J.
I made a little minesweeper game and I want to send it to a friend so he can test it out. The problem(probably) is that he isn't able to run it because he doesn't have Java for programmers(JDK) installed on his computer. How is it possible to export a program that will work on other computers without having to download any other files**(other than JRE)**?
EDIT: I did read about converting the JAR to EXE but I couldn't find anything that would do it.
EDIT2: Download here the JAR file(it's only supposed to open a blank window). I tested it on two computers with JDK installed and it worked, whilst on two others without JDK(one with the newest JRE) it couldn't start. This is the error:
.
There is no way to "not have to download any other files" - your friend must minimally have some Java Runtime Environment (or just "Java") installed in order to run Java programs.
If your friend has Java installed, you can package your application as a fat JAR so that he only needs your JAR to run your application (depending on the application - but I think yours should be fine).
There are tools available, google "java windows executable" and you will find e.g.
Convert Java to EXE
http://jsmooth.sourceforge.net/
Or already on SO
How can I create a Windows .exe (standalone executable) using Java/Eclipse?
Java Web Start is ideal for this, as it can enable the user to install required components on supported platforms. There's a simple example here.
Not possible, a JRE (Java Runtime Environment) is the least that must be present.
If that is you can just export your program as jar specifying the main class in its manifest. Your friend should if a JRE is installed be able to run the jar file directly.
You could send your friend the compiled binary of your game. In that scenario, your friend will only need to have the Java Runtime Environment installed in order to play your game.
Make executable JAR from it, your friend will still need JRE.