Unable to produce some MVC to reproduce the issue. So trying to be clear & concise.
We utilize ant/make
The include path to building the C++ portion utilizes a header (jni.h) from the java installed directory
Example Error (During Build Process)
3)
*File.h(2): fatal error C1083: Cannot open include file: 'jni.h': No such file or directory
make: *** [File.obj] Error 2*
Another error also shown is:
cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include', object file assumed
cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include' ignored
cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include\win32', object file assumed
cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include\win32' ignored
This is the include path as part of the compilation step (Yes this path exists) -IC:\Program Files\Java\jdk1.8.0_281\include
Now when I copy the files necessary to a path that's called ProgramFiles\Java... (No spaces in ProgramFiles) it works fine.
I have a variable retrieved from a .platform file which is utilized for the build, which defines JDK_HOME. I believe this file is utilized for ant/make builds and uses these defined variables in this file.
Any ideas/paths as to ant or make not liking spaces in the include paths, or anything along those lines? I've looked at many resources online, but very hard to describe the issue.
Problem clearly is the space in Program Files. Not sure what is so significant about this.
Hoping the bullet points help in any information needed with anyone who could be familiar with this issue or might have leads. Thank you.
I'm not sure what ant has to do with this. But make recipes are just shell scripts (or, if you use Windows cmd.exe instead of a POSIX shell, batch files). Just like commands you'd write in a batch file or on the command line directly, you have to add quoting to paths that contain whitespace.
You don't actually show us either the make recipe or even the complete compile (cl) command line that make invokes so we can't give you precise advice, but basically if you cut and paste the command line make invoked into your terminal prompt you'd get exactly the same errors about whitespace. Make is not magic: it only runs the commands you tell it to run.
Just like you have to add quotes around paths containing whitespace when you run them from the terminal prompt, so too you need to add quotes to these paths when you run them from a makefile recipe.
Related
so I'm trying to run my program and I keep getting the error when I run my main class it says that given property file isn't found, below are two images of the file location and the arguments I've putten in and the error that appears, I'm struggling to realize why the file isn't being located, any help?
Because Windows in its wisdom thinks that hiding extensions of known file types is a good ting. You files is called input_parameters.prp and inputs.in, I guess.
If you give those names it would probably find this files.
To be sure you can open a cmd or powershell windows and run the dir command in that folder to see the complete names.
I have a simple jar test program which I use to parse xml with xquery file.
Problem is that in the xquery file I declare a java namespace :
declare namespace java="java:MyString";
Then for testing purpose I just have a static method toString(Object o).
When I execute it outside of Eclipse (who managed the classpath correctly when I set a class folder manually) I get the error in the title :
> C:\>java -jar XQueryJava.jar
> -xq XQuery\test.xq -xml XQuery\test.xml Error on line 9 of XQuery\test.xml: XPST0017: Cannot find a matching 1-argument
> function named {java:MyString}toString() ; SystemID: XQuery\test.xml;
> Line#: 9; Column#: -1 net.sf.saxon.trans.StaticError: Cannot find a
> matching 1-argument function named {java:MyString}toString()
> at net.sf.saxon.query.UnboundFunctionLibrary.bindUnboundFunctionCalls(UnboundFunctionLibrary.java:114)
> at net.sf.saxon.query.StaticQueryContext.bindUnboundFunctionCalls(StaticQueryContext.java:1479)
> at net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:106)
> at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:472)
> at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:502)
> at xpath.AffichageXPath.execute(AffichageXPath.java:91)
> at xpath.AffichageXPath.main(AffichageXPath.java:49)
I tried to use "-cp" and the folder I put the .class file in :
java --class-path XQuery\class -jar XQueryJava.jar -xq XQuery\test.xq -xml XQuery\test.xml
But still same issue.
If I put the class file in the same folder as the jar everything is fine.
Why is it not working with the CP argument ? I thought it was the point of it...
Any idea ?
Thanks.
First the stack trace shows that you are invoking the processor with
net.sf.saxon.query.StaticQueryContext.compileQuery
which is a pretty low-level entry point, and there are many ways of getting things wrong at this level. I would recommend you use the s9api interface (XQueryCompiler.compile()).
One of the things you can easily get wrong is to run without Saxon-PE/EE enabled. Calls to reflexive extension functions require at least Saxon-PE, which also needs a license file to be present. Check that the Saxon Configuration is a ProfessionalConfiguration or an EnterpriseConfiguration.
Using the -TJ option on the command line, or the equivalent configuration property in the API (FeatureKeys.TRACE_EXTERNAL_FUNCTIONS) will give you better diagnostics as to why it is failing to find the function.
Finally, note that using -jar on the Java command line means that the class path is ignored: everything has to be loaded from the JAR file itself. This makes it quite difficult to pick up the license file and any external library classes, so it is best avoided.
Out of desperation of lack of ideas I'm currently working on a way to compile a single file from inside an eclipse plugin.
So far, I've successfully made code that compiles a single .java file that has no external .class (without being inside .jar) dependencies.
For the compilation process, I know where all the dependency .class files are and I give that information to the compiler using -classpath option.
Currently, I'm calling the compiler like this:
String[] params = new String[]{
"-properties", propertiesFile,
"-g", "-preserveAllLocals",
"-classpath", classPath,
fileToCompile,
"-d", outputPath,
"-proc:none",
"-proceedOnError",
};
boolean result = BatchCompiler.compile(
params, new PrintWriter(outWriter), new PrintWriter(errWriter), null);
The variables:
propertiesFile: exists and it contains the merge of the workspace + project's settings without repetition (in that order).
classPath: contains multiple paths separated by ";" (this one has problems, see below)
fileToCompile contains the absolute path of the file I want to compile. Do note that this file is not in the sources directory.
outputPath: The directory where the "bin" of the project is. It gets it from the IProject object itself.
You may find the meaning of the other options here.
classPath is giving me an error. Two classes exist in this test project:
This is its content (after reducing the size by removing most .jar includes from native java:
"C:/Program Files (x86)/java/jre1.8.0_66/lib/resources.jar";"C:/Program Files (x86)/Java/jre1.8.0_66/lib/rt.jar";D:/Users/user/runtime-EclipseApplication/Tests/bin"
I've tried using these as the last "include" in the classpath:
"D:/Users/user/runtime-EclipseApplication/Tests/bin"
"D\:\Users\user\runtime-EclipseApplication\Tests\bin"
"D\\:/Users/user/runtime-EclipseApplication/Tests/bin"
"D\\:\\Users\\user\\runtime-EclipseApplication\\Tests\\bin"
Here's the output it gives in stderr:
incorrect classpath: "D:/Users/user/runtime-EclipseApplication/Tests/bin"
----------
1. ERROR in D:\Users\user\runtime-EclipseApplication\.metadata\.plugins\myplugin\tmp\sources\Test2.java (at line 3)
public class Test2 extends Test{
^^^^^^^^
Test cannot be resolved to a type
I can assert in my own code that, just before the compiler is called:
That classpath directory exists
That Test.class is in that directory
I'm using the default package at the time that code executes
What am I doing wrong here? Why is it classifying it at an incorrect classpath?
I'm using org.eclipse.jdt.core(v.3.10.2) dependency and I'm compiling in eclipse Luna (4.4) which is the minimum version I want my plugin to support.
After days around this, somehow...
"C:/Program Files (x86)/java/jre1.8.0_66/lib/resources.jar";"C:/Program Files (x86)/Java/jre1.8.0_66/lib/rt.jar";D:/Users/user/runtime-EclipseApplication/Tests/bin <- No ending quote
That worked. I don't remember anymore if I did anything else but it works like that regardless if it has spaces or not.
I'm still wondering what is causing the inconsistency between the first elements using quotes but my element mustn't use any quotes.
I am trying to install Java jre 1.8u31 from the command line. I am using system level install configuration by using the deployment.config file and deployment.properties.
I have tried the following:
deployment.system.config=file\:C\:/WINDOWS/Sun/Java/Deployment/deployment.properties
deployment.system.config.mandatory=true
I have also tried the following
deployment.system.config=file:///C:/Windows/Sun/Java/Deployment/deployment.properties
deployment.system.config.mandatory=true
I have swapped the entries around in hopes of getting a better error describing what I am doing wrong. I have also made the first line blank in the deployment.config file. I have googled and tried all examples I could find online. In all the cases, I am being presented a dialog box with an error that states the deployment.config file's line 1 is malformed.
Any suggestions would be greatly appreciated.
Russ
I have tried all of these formats:
The path you have given should be in below format
deployment.system.config=file:/C:/Windows/Sun/Java/Deployment/deployment.properties
I got the install to work correctly. What I did was put the deployment.config file in the C:\Windows\Sun\Java\Deployment directory. The property in the file was setup as so:
deployment.system.config=file\:C\:\\Sup\\Java\\UPGRADE\\Deployment\\deployment.properties
The exceptionlist file was in the same directory as the deployment.properties file.
So I have a java project with multiple java files.
I know that is almost straight forward to start a java application using batch file. But that is for a pretty simple java program with a single class.
However I am wondering if it is possible to do that with in a scale of a project that you usually create using eclipse. A large project with multiple packages, classes and multiple java files.
My try was to write a script and apply on the main class as following
set path = C:\Program Files\Java\jdk1.7.0_25\bin
javac -classpath twitter/twitter4j-stream-3.0.5.jar;twitter4j-core-3.0.5.jar" sourcepath="lib/twitter4j-core-4.0.1.jar;lib/twitter4j-core-4.0.1.jar;lib/twitter4j-stream-4.0.1.jar;svm_light_lib Program.java
java Program
However when I start the .bat file it automatically closes.
Any Ideas ?
Thanks in advance
First, never overwrite the environment variable path, not even
temporarily. Append your folder instead: set "path=%path%;%mypath%" or set "path=%mypath%;%path%".
(There exists a particular path command but I'm not sure about right syntax: path=%path%;%mypath% with = assignment or path %path%;%mypath% without it).
Use full path to a program if you know it, e.g. "%mypath%\javac".
For better readability, values for -classpath and -sourcepath options are stored to the environment variables mycpth and mysrcp, respectively. Note and use proper " quotation and no spacing around = to avoid any leading and trailing spaces in all set commands.
pause to see all the javac output. Displays the message Press any key to continue . . .
Next code should be (syntax) error-free. However, success depends (among others) on classpath and sourcepath entries visibility as well...
set "mypath=C:\Program Files\Java\jdk1.7.0_25\bin"
set "path=%path%;%mypath%"
set "mycpth=twitter/twitter4j-stream-3.0.5.jar;twitter4j-core-3.0.5.jar"
set "mysrcp=lib/twitter4j-core-4.0.1.jar;lib/twitter4j-core-4.0.1.jar;lib/twitter4j-stream-4.0.1.jar;svm_light_lib"
"%mypath%\javac" -classpath "%mycpth%" -sourcepath "%mysrcp%" Program.java
pause
java Program
However I am wondering if it is possible to do that with in a scale of a project that you usually create using eclipse. A large project with multiple packages, classes and multiple java files.
Of course it is possible!
In this case, I suspect the problem is that you java command doesn't have a "-cp" argument. The java command is probably failing because it can't find twitter classes ... at runtime.
Remember to include "." on the classpath ... or else java won't find the file that you just compiled.
#JB Nizet's suggestion is also very important advice for finding out what is actually happening.