Java : Error on build - java

I made an application in Java with Netbeans, but when I wanted to export it (build) an error message is displayed :
C:\Users\DALY\Documents\NetBeansProjects\VacheTaureau\nbproject\build-impl.xml:926: The following error occurred while executing this line:
C:\Users\DALY\Documents\NetBeansProjects\VacheTaureau\nbproject\build-impl.xml:268: Class not found: javac1.8
BUILD FAILED (total time: 1 second)
here is a screen print

Yes my friends, I found the solution to this problem!
In fact I downloaded Apatch Ant (TM) version 1.96 and it works!
here's the ant link
Apatch Ant V 1.96
Description:
We must extract the file 'apache-ant-1.9.6-bin.zip' downloaded to folder and you must put this folder under the following path :
C: \ Program Files (x86) \ NetBeans 7.3.1 \ java.
Then in NetBeans, go to the menu:
Tools> Options> Java
then you must change the way Ant home of the folder ( 'apache-ant-1.9.6-bin').
print Screen

Related

Error when building Netbeans 11.0 from source

I installed Apache Ant version 1.10.5 on my Windows 10 desktop system in order to build Netbeans 11.0 from source. I set the environmental variables and ant seems to be running properly. However, when I cd to the Netbeans folder and run ant to build it, I get the following error:
BUILD FAILED
E:\Netbeans 11.0\nbbuild\build.xml:514: The following error occurred while executing this line:
E:\Netbeans 11.0\nbbuild\build.xml:509: The following error occurred while executing this line:
E:\Netbeans 11.0\nbbuild\build.xml:556: The following error occurred while executing this line:
E:\Netbeans 11.0\nb\updatecenters\build.xml:44: exec returned: 1
Does anyone have any idea what would be causing this or where I could look up what the possible causes of "exec returned: 1" could be? Also, I am using jdk1.8.0_212.
Here is the surrounding code for the build.xml file:
39 <target name="bootstrap" description="Bootstrap NetBeans-specific Ant extensions."
40 depends="-jdk-init,-load-build-properties">
41 <fail message="You need to run on JDK 8+ to build NetBeans; java.home=${java.home}">
42 <condition>
43 <matches pattern="^1\.[01234567].*" string="${java.version}"/>
44 </condition>
First thing you should have JDK 8+
Second you need good internet speed.
or i can Say a very simple solution for you all
Just go netbeans https://netbeans.apache.org/
don't go for source file
download bin.zip file
after extracting the zip folder paste in c:\ Drive
and open the netbeans folder you will
C:\netbeans\bin
in this you find 2 exe file
netbeans.exe
netbeans64.exe
run as per your system is 64bit or 32bit
In my case that was a folder create permission issue . So, on windows I ran command prompt as administrator. Have ran
ant
Then this error disappeared

Android NDK hello-jni program throws error while building

i am new to NDK , i am trying to run the sample code that is present in NDK samples.
I am using the guidelines under the following page:
https://developer.android.com/tools/sdk/ndk/index.html#Downloads
Under the "Exploring the hello-jni Sample", when i run the following command in Commandline:
android update project -p . -s
I am getting the following error:
Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.
the below is the complete log:
ethics-14#ethics14-desktop:~/NDKworkspace/HelloJni$ android update project -p . -s
.Updated local.properties
Updated file ./proguard-project.txt
Updated local.properties
Updated file ./tests/proguard-project.txt
Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.
Also under project.properties file i am able to see:
target=android-21
this looks like a bug in the android tool: a part of the project is actually updated to the latest android target (including the target property inside project.properties), but then it's failing at some point.
To work around this issue, you can manually specify the android target:
android update project -p . -s -t android-21
It seems that your files are saved with the wrong case, the file should be named project.properties with a lowercase p.

Unable to Install ANT to clone library of Volley

I am unable to Install ANT, but i get install GIT, so i make a Folder in C Drive and paste the ANT unzipped files.
I have following location of installations,
1) JAVA: <D:\jdk1.7\bin>
2) GIT : <C:\Program Files\Git\bin>
AND
3) i created a Folder in C Drive for ANT : <C:\ant\bin>
Using Command prompt ,
i can execute the the command git , successfully . But when i put command ant, gives the following error
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed
My environment variable set to the following path,
ANT_HOME = <c:\ant\bin>
JAVA_HOME = <d:\jdk1.7\bin>
Path = <%PATH%;%ANT_HOME%\bin;>
That's all , Thanks.
According to the information you provided, PATH variable should look like following:
%JAVA_HOME% ; %ANT_HOME% ; <other entries>
It seems that you're using Windows, thus you should check both your user-scope and system-scope environment variables (Computer - Properties - Advanced System Settings - Environment Variables).
Currently your build is failing due to JRE-related entry in PATH variable. Please remove it and retry.
Easiest way to check that the issue is resolved is to execute this from your command line:
javac -version
Normally this will give output like following:
javac 1.7.0_40
Install java and add it to class path by either creating java_home or directly to path variable in windows. Do the same thing for ant too. ie) place the ant location[upto ant\bin] in path variable and open the command prompt type ant . you will get the output as build failed which expects build.xml. Same will be applicable for git and other utilities...
hope it helps
i got the solution, Just download the project given in the link below ,
http://www.java2s.com/Open-Source/Java_Free_Code/Image/Download_Volley_demo_Free_Java_Code.htm
And import using Eclipse, and RUN. That's all . no need to make git reference. ( if you getting error continuously )
volley.jar you can use in your custom projects also.

can't get Ant to work

I am trying to run Cordova on my ubuntu 12.04. When I try to create the project, its throwing me this error
k#k-cm:~/Development/Android/ionic/hello$ cordova platform add android
Checking Android requirements...
Creating android project...
[Error: An error occured during creation of android sub-project. Looks like your environment fully supports cordova-android development!
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionic.toderp
Name: toderp
Android target: android-17
Building cordova-3.2.0.jar
{ [Error: Command failed:
BUILD FAILED
/home/k/Dev/android-sdk-linux/tools/ant/build.xml:710: The following error occurred while executing this line:
/home/k/Dev/android-sdk-linux/tools/ant/build.xml:723: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-7-openjdk-i386/jre"
Total time: 0 seconds
] killed: false, code: 1, signal: null }
]
Here is my PATH
/usr/lib/jvm/java-7-openjdk-i386:/home/k/Dev/android-sdk-linux/tools:/home/k/Dev/android-sdk-linux/tools:/home/k/Downloads/android-ndk-r8e:/home/k/Downloads/android-ndk-r8e:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/k/Home/k/Dev/android-sdk-linux/tools:/home/k/Home/k/Dev/android-sdk-linux/platform-tools:/usr/lib/jvm/java-7-openjdk-i386/bin
JAVA_HOME
/usr/lib/jvm/java-7-openjdk-i386
Please help!
This issue is due to that Ant can not find the tools.jar file.
You need to copy the tools.jar file and put it in the lib folder for the ant to work.
Do a search for tools.jar file in the lib folders from other sdk libraries and put that in the above path in error.

Cannot determine current directory

I am trying to run a .jar file that was created successfully in Netbeans and I am receiving the following error:
Error occurred during initialization of VM java.lang.Error:
Properties init: Could not determine current working directory. at
java.lang.System.initProperties(Native Method) at
java.lang.System.initializeSystemClass(System.java:1070)
The command that I type to run the .jar is
java -jar "/path to the dist forlder/EOPPrototype.jar"
My classpath is as follows:
CLASSPATH=/opt/netbeans-7.1.2/ide/modules/ext/mysql-connector-java-5.1.13- bin.jar:/h/USERS/local/pagola/NetBeansProjects/mylib/dist/mylib.jar:/h/USERS/local/pagola/NetBeansProjects/EOPPrototype/build/classes:.
What am i missing?
I saw the same error when I was trying to call java -version inside a directory, which I already had deleted from another terminal session. Of course in that case java could not determine the current working directory, simply because it didn't exist.
Solution: cd to another directory and run that command again, that works for me.
See explanation here: https://bugs.openjdk.java.net/browse/JDK-8186434
In Fedora 21, I tried calling the "java -version" after an uninstall and it gave the above error. Close all the terminals and open them again and try.
Should work.
I was getting the same error message, but I'm not sure if it was for the same reason as I don't use Netbeans. I use my terminal and compile with ant.
I cd'd to a directory to run a javafile.class file. The file I want to run is part of a bigger package. The directory structure of the package looked something like this: a/b/c/javafile.class. The a, b, and c directories are all part of a larger package.
To run my javafile.class, I cd'd into a and ran the file from there: java b/c/javafile. After I made some changes and recompiled with my ant script, the directory I was in had been deleted and remade by ant. So, when I ran javafile.class again, I got the error you're getting.
I fixed my problem by cding out of the directories that are deleted and remade by ant and then running my javafile.class again.
maybe you did not config java environment on your workstation correctly
the following configurations were what I did in my mac
vi ~/.bash_profile
and add those in it
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
replace
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
with your jdk version
and then run
source ~/.bash_profile
to use these config immediately
then you can check by
java -version
I got the same error -
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
by just doing 'java -version' (you would think it wouldn't need to bring up a
virtual machine just to answer a simple question like 'what version are you?')
A higher up element (that between the slashes) of the directory path of the pwd
had spaces in it. When I made the current working directory one which from /
downward didn't have any spaces the 'java -version' command got a proper response.
I'm concluding they didn't account for directories with spaces when they
programmed it. But that was version 1.7. I've now loaded version 8 so hopefully
it has been corrected.
I got this error on Mac OS X and this is a genuine error since the directory has vanished. The directory I was when I am executing the commands is <PROJECT DIR>\target.
The problem was I opened two terminals in the other terminal I ran mvn clean install and the target directory from PROJECT DIR got deleted and recreated.
My old terminal from where I was executing Java commands is not in a valid directory.
The file descriptor is invalid since the directory got deleted by Maven.
When I moved back to the parent directory and the changed back to the target directory, the java command started working correctly as expected.
Under CentOS, rhel, SL or SLC? Not an issue under debian/ubuntu.
I found you need to logout of the shell you are using and log back in. The environment is not set up initially correctly for the current shell. After login I see that: java -version will work.
Also ensure that /etc/alternatives/java actually points to something reasonable like:
ls -lisa /etc/alternatives/java
72645 0 lrwxrwxrwx. 1 root root 46 May 27 11:29 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
Just now, i got the same error. because i use java to setreuid/setregid to apache:apache, when i change back to root:root, i changed gid before uid, the real result is root:apache. everything going wrong, such as the error say "java.lang.Error: Properties init: Could not determine current working directory. "
you can check it.
I was having this error in my mac, when I start tomcat from my eclipse. After setting JAVA_HOME and restarting the eclipse, the error is fixed.
You have to install default-jdk first !
sudo apt install default-jdk
only version 11 does not set all the environment correctly
in place of : sudo apt install openjdk-11-jdk
You may get this error if you issue "java -version" or other java command from a read-only directory. For example using openjdk 8 on centos (as non-root user):
cd /usr/bin
java -version
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.

Categories

Resources