I have downloaded a .jar file and it won't run on my computer. I have installed Java RE 5.0 and have Java 7 update 72. Every time I double click on the file it pops up and closes.
I have reinstalled the java re and java 7u72 and still no success.
Any help with running executable .jar file on windows 7?
By default, java does not run in windows mode, maybe it's just a console java program.
The .jar file must have a lib folder in the folder the .jar is in to open a window (without using native java libraries). If it doesn't, then the .jar won't open any windows, as it needs external libraries to do so.
However, if your .jar isn't meant to open any windows, then it has been performing as expected. Try running your .jar from the command line:
java -jar <jar-file-name>.jar
Have you checked the Environment Variables? Maybe the variable PATH is not specified. Besides, you can try this:
Start - "Control Panel"
Click on "Default Programs"
Click on "Associate a file type or protocol with a specific program"
Double click on the .jar
Browse C:\Program Files\Java\jre7\bin\javaw.exe
Click on the button Open
Click on the button OK
If it doesn't work, try to configure the Environment Variables:
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Note: You may see a PATH environment variable similar to the following when editing it from the Control Panel:
%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
Variables enclosed in percentage signs (%) are existing environment variables. If one of these variables is listed in the Environment Variables window from the Control Panel (such as JAVA_HOME), then you can edit its value. If it does not appear, then it is a special environment variable that the operating system has defined. For example, SystemRoot is the location of the Microsoft Windows system folder. To obtain the value of a environment variable, enter the following at a command prompt. (This example obtains the value of the SystemRoot environment variable):
echo %SystemRoot%
More info here
Hope it helps.
Clemencio Morales Lucas.
Related
I know this is SUPER basic. I am very new to all of this. I tried to download java and run a helloworld by following these instructions: https://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html
I got an error when I tried to use the "javac" command to compile. This is what appears in the command prompt:
C:\Users\USer18\Desktop>javac HelloWorldApp.java
'javac' is not recognized as an internal or external command, operable program or batch file.
Does this mean I downloaded java incorrectly? When I downloaded it, there were 3 different things to choose from, but I could only choose one, so I chose the first one. I tried to download java again and select the second one, but it said it didn't work.
Thanks in advance for helping me!
From the tutorial you linked, it tells you to "consult the installation instructions" found here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html
For Windows JDK, the instructions linked are here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jdk_install.html#CHDEBCCJ
The part you need to look for is "Updating the PATH Environment Variable"
Updating the PATH Environment Variable
If you do not set the PATH variable, you need to specify the full path
to the executable file every time you run it, such as:
C:> "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java
It is useful to set the PATH variable permanently so it will persist
after rebooting.
To set the PATH variable permanently, add the full path of the
jdk1.8.0\bin directory to the PATH variable. Typically, this full path
looks something like C:\Program Files\Java\jdk1.8.0\bin. Set the PATH
variable as follows on Microsoft Windows:
Click Start, then Control Panel, then System.
Click Advanced, then Environment Variables.
Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value
for the PATH variable:
C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin
Note:
The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks
for programs in the PATH directories in order, from left to right.
You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.
If you are not sure where to add the JDK path, append it.
The new path takes effect in each new command window you open after setting the PATH variable.
When ever we execute any command, it is searched in the directory where we are current in or mentioned in PATH environment variable. The oly thing which you need is just add <path of yourjdk>\bin to PATH
Windows 10 and Windows 8
In Search, search for and then select: System (Control Panel)
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Windows 7
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click the Advanced system settings link.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Reopen Command prompt window, and run your java code.
I've searched around a bunch and could not find an answer that could help me.
I get this message when building my Ionic project for Android. I have verified, that both java -version and javac work in the folder, so both are accessible via the %path%.
What can I do to resolve this, and did I miss something?
I'm not familiar with Ionic but apparently it is not using %PATH% , it is using %JAVA_HOME%. You need to set it.
Determine the directory of a Java JDK (not JRE) in your system. It could be something like C:\Program Files\Java\jdk1.8.0_65. Since javac responds, you must have a JDK in the path somewhere. This directory will be the value for JAVA_HOME. (NOTE: This is not the same as the Java bin directory in the path! There should not be a bin on the end of the directory.)
Open the System page in your Control Panel.
You can do this in various ways:
Open an Explorer window, right-click on This PC and click on Properties in the menu.
Open Control Panel, click on System and Security, click on System.
Click on Advanced System Settings.
The System Properties window opens. Select the Advanced tab.
Click on the Environment Variables... button.
The Environment Variables window opens. Look at the bottom section labeled System Variables. You should see a variable named JAVA_HOME in the list. If you have this variable, double-check that the directory in the value exists and is a valid JDK directory.
If you don't see JAVA_HOME in the list, click the New... button. If JAVA_HOME is there but it's the wrong value, select JAVA_HOME in the list and click the Edit... button.
The New System Variable or Edit System Variable window will open (they look about the same.) Enter "JAVA_HOME" for variable name and the JDK directory for variable value. You can use the Browse Directory... button to make sure you have a valid directory for the value.
Click the Okay button on the New/Edit System Variable window, then the Environment Variables window, and then the System Properties window.
You will need to log out and log in again for the JAVA_HOME variable to take effect.
Hi I have set the environment variable for java in windows.
when I type java in cmd, it works,but when I type javac ,it doesn't work saying javac' is not recognized as an internal or external command,
Doing Path="C:\Program Files\Java\jdk1.7.0_09\bin works but when I close the command prompt and reopen again same error.
Is there anyway out to set this permanently.
You can add C:\Program Files\Java\jdk1.7.0_09\bin to your path using the System Control Panel in Windows.
Go to Control Panel -> System -> Advanced System Settings -> Environment Variables...
Find Path, and edit it to add your jdk path.
It sounds like you simply setting the PATH variable of the current session. What you need to do it go to "Computer/My Computer", right click and select "Properties". From there click "Advanced System Settings" and then the "Environment Variables button. Navigate to the PATH variable and append to the end of the string. Directory paths must be separated by a semi-colon.
All of the variables in this section are loaded each time a new process is launched. You can also add a default CLASSPATH variable here and include all of your go-to jars.
Recently I have faced this problem and my finding is for Windows 7 adding javac to the "path" environment variable works but for windows 10, you can do anything means Add a new environment variable or update the existing one.
i configured maven home in uservaribles and tested it using the command mvn --version ,system proment me as "mvn is not a command" . But if i configure it to System variables its working. i did configuring to system variables in my laptop. But at my office i dnt have previlage of changing system variables.
Here my question is.
a) Why system recognises when it is configured from system variable but not in user variables
b) is there any alternative to configure it and work smoothly at my office laptop.
well what I did at my job (I was having the same problem) is making a user variable that's called PATH, to the binaries. And then it seems to work here.
Right click my computer
Click on properties
On the left you will find advanced system settings (windows 7). Click on it
Then go to the tab Advanced and click on Environment Variables
Now create a new user variable with the name PATH and the value, is the path to your maven installation. (eg: C:\maven\bin)
How to change the default project directory in Netbeans 6.9 for Java SE\ME\EE?
I don't think you can make it module-specific but you can set it as follows:
Close NetBeans
Find the projectui.properties file. For me (Windows) it was under C:\Documents and Settings\Catchwa\.netbeans\6.9\config\Preferences\org\netbeans\modules\projectui.properties
The projectsFolder=C:\\NetBeansProjects variable is I think what you want to change.
I found mine in a slightly different location (Windows 7 64-bit using Netbeans 7.2):
C:\Users\UserName\AppData\Roaming\NetBeans\7.2\config\Preferences\org\netbeans\modules\projectui.properties
Slightly different way of doing it for NetBeans 7.3 latest release (at least for Windows 7, 64-bit). Search your system for netbeans.conf (from explorer window) or go to its default install location:
C:\Program Files\NetBeans 7.3\etc\netbeans.conf
Look for netbeans.conf on Mac OS X:
find / -name "netbeans.conf" -print &
Look for netbeans.conf in Linux:
sudo find / -name "netbeans.conf" 2> /dev/null
Then edit the netbeans.conf file to replace the userdir line:
netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/7.3"
With your new projects directory/folder path:
netbeans_default_userdir="C:/APPS/netbeans/"
-OR-
netbeans_default_userdir="\Applicatons\netbeans\"
(NOTE: if you have trouble in Windows in a network managed security environment, you'll need admin access to make this change. Open the file using your editor's ".exe" directly by right-clicking the launcher file and clicking "Run as Administrator", I had to do this for Notepad++ because it said "Another application is using the file", but in fact it was just locked to non-admin users).
This changes the default userdir which stores user-specific IDE settings, but not the default project folder/directory. Next, you need to open NetBeans IDE with the new IDE settings and start to create a new Java project (then cancel after second screen in project creation wizard). It will now create a new projectui.properties file in the userdir you set; this is the file that wasn't found before this workaround that you need to edit as per the other suggestions. Mine was located here after these changes:
C:\APPS\netbeans\config\Preferences\org\netbeans\modules
Finally, you've reached the finish line and can change the projectsFolder property value to the path you want, if you don't see a line for projectsFolder then simply type or paste one in at the bottom of the file to point to your path where you want NetBeans to store projects by default, such as:
projectsFolder=C:/APPS/projects/
-OR-
projectsFolder=\Applicatons\projects\
Wow, that's alot of settings changes but it finally works for me the way I wanted it to, being able to switch my IDE back and forth between a local workspace and a network workspace using my username space on the corporate LAN just by changing projectsFolder property value in the projectui.properties folder.
NOTE:
On Linux or Mac you might not need the first step of modifying netbeans.conf as the projectui.properties should be as follows (may vary by OS version):
$HOME/.netbeans/7.3/config/Preferences/org/netbeans/modules/projectui.properties
Under Windows 7, logged in under AD, the projectui.properties file's directory was under the parent folder listed in the USERPROFILE environment variable (type set in a command prompt window):
C:\Users\my_login_name\\.netbeans\7.0\config\Preferences\org\netbeans\modules\projectui.properties
It was not in the directories pointed at by the HOME or APPDATA variables.
Changed projectsFolder value to new location, restarted NetBeans and default folder for new projects was in the new location. It worked!
In linux/Ubuntu
View hidden files in home directory (press ctrl+H on /home folder).
.netbeans\7.3\config\Preferences\org\netbeans\modules\projectui.properties
Update the following content in projectui.properties file
projectsFolder=/home/folder/NB
In newer versions, right-click on the project you want to move in the 'Projects' tab, and then click 'Move'. This will allow you to move the project to a new directory.
In windows 7 64 bit properties file can be found under c:\Users\user\AppData\Roaming\NetBeans\7.2.1\config\Preferences\org\netbeans\modules\ folder