I am using eclipse Luna with CVS for its synchronization and committing. However I keep getting a weird outcome from using it. For example my java class and file is named PrimeSieve. So when I commit the change, the file goes from being called PrimeSieve.java to PrimeSieve.java,v (the ,v gets appended). I don't quite understand or know where to get the resources to get the information to fix this. The reason I am trying to fix this is because when I run javac the ,v at the end gives me a bad flag warning with the compiler. Can anyone help me with this?
With CVS at the end of each file it appends a ,v because that is indication of the type of file it is. Any file with a ,v at the end of it is a history file.
For you to be able to make use of the .java class you would have to checkout the history file like so:
co yourJavaFile.java,v
This leaves you with
yourJavaFile.java
Hopefully this helps someone.
Related
so I did run into one very weird issue. The idea is simple: create temp dir, place some files in it and then try to access them. Now the problem is that calling File.createTempDir() or Files.createTempDirectory(prefix) creates new file inside AppData/Local/temp with shortened path, so the full path to folder looks something like C:/Users/FirstNam~1/AppData/Local/Temp/myFolder/myFile.txt instead of C:/Users/FirstName LastName/AppData/Local/Temp/myFolder.myFile.txt.
The difference is that generated path inside java contains FirstNam~1 instead of FistName SecondName. Java then throws exception File Not Found.
When I try to copy and paste shortened path into file explorer I get an error saying that file does not exist, but if I do change shortened path to full one then file opens and it works as intended.
Is there any way to fix it? Ether by forcing java to use full path names or enabling something in windows? I did Enable NTFS long paths policy, but it did not help.
This is happening when using java 8/11 and windows 10 running on VM, project is using AGP and gradle. Temp file is created inside groovy file that extends Plugin<Project>
Just when I lose hope and create a ticket, couple hours after that I find the answer. So, java has method Path.toRealPath() which solves this ~1 issue. After using this method paths no longer contain shortening and are correctly resolved.
EDIT: looks like java is doing everything correct and paths are actually valid, problem did come from library that I'm using and it's a bug with it.
In this previous question, I was trying to rework some Matlab code and figure out a package called javaplex to be compatible with Octave; it uses Java, but is tooled for Matlab, hence that issue. Now in an interval of time, I was busy/running simulations, and hadn't gotten around to a final step - actually using the package, with most all of the difficulties worked out. It turns out that another step exists: I need to convert an Octave array to a Java array (although I'm not sure why this issue didn't come up in Matlab).
To do so, I have turned to this script, in which the comments indicate that when using it, it
Assumes the JIDT [Java Information Dynamics Toolkit] jar is already on the java classpath - you will get a java classpath error if this is not the case.
So I go to the JIDT GitHub page and download this package. Now I am not a very avid user of java, so I believe I am failing to see something fairly straightforward: I am not sure where the "JIDT jar" is that is referenced in the above block quote! I can't find such a particular jar file to put in Octave's java classpath. In this tutorial for JIDT, they say you need the "infodynamics.jar" file in the classpath (page 9). I'm not sure what jar file I should be looking for, and where. Any help understanding the nature, name and location of this jar file (within the infodynamics toolkit folder) would be appreciated!
As an inevitable follow-up question, because this will come up upon resolving this issue, I would like to clarify the following procedure is how to add a jar file to the Octave (static) java classpath (following this answer here, I wasn't sure if I was implementing correctly):
I create a file called "javaclasspath.txt" inside of the directory I use in Octave.
I enter the name of files as follows: "./path/to/your-file.jar"
I suppose my main issue here is where do I start the path (all the way back with "C:/..."?), and do I put this "javaclasspath.txt" file in the directory folder I will be using most of the time in Octave?
Edit: I cannot find "infodynamics.jar" as shown here:
The JIDT jar is named infodynamics.jar and it is located in the root of the downloads infodynamics-dist-1.4.zip file.
When running my project, I get this error.
Error:java.lang.IllegalArgumentException: Invalid resource path: C:\Android\Source Code and Samples\turbo-editor-master\turbo-editor-master\app\src\main\res
Any idea what is causing this?
I am using source code from the Turbo Editor app and have done no changes to the app prior to running it.
Try two things:
- Clean your project. This helps most of the times
- Go to the directory mentioned in the Exception. Make sure it actually exists.
I found the error. While looking at the error, follow the path that it is referring to. If there is no path like that, or a file missing, then create it and move the file to that path. Should fix the problem.
Illegal argument exception is throwed when a function gets wrong (it cannot reasonably deal with it) argument. This can be caused by, for example, missing function that was somewhere overrided. In your case - maybe this is issue with path? I'm not sure but if the path exists you can try changing it so it does not have "spaces" and capital letters. Please dump complete log with error.
First, my issue is similar to those two :
JAVA gettext commons
error reading .po file in java
I want to use GNU Gettext utility for internationnalizing my app. I managed to get it working by creating a translations.properties file with the proper key-value pair but it wont get my translations_fr_CA.properties even if I explicitly set the locale to fr_CA or Locale.CANADA_FRENCH. This was my first issue.
Second and most important issue : I can't get rid of the .properties file which is crap as I can't use the nice gettext complete msgid . I managed to compile my .po file to a .class with msgfmt --java2 [...] but the ResourceBundle won't load without a .properties file.
Here is a zip of my current testing project : java_gettext_testing.zip
I included gnu.gettext.GettextResource in the zip to make it simpler. You can compile with javac test/*.java and run with java test.test
Thanks for any help!
I figured it out finally. I don't know why but I cant use .class files without putting them in a package. I reworked my structure and finally I can compile my .po file with
msgfmt --java2 -d . -r test.translations translations.po
which will compile the ./translations.po file to test/translations.class giving it the appropriate package information.
Now I can do this
ResourceBundle myRes = ResourceBundle.getBundle("test.translations"); // load my test/translations.class file
GettextResource.gettext(myRes, "message id to translate");
Still got to get the locale working but the essential is there for me right now.
Edit This question helped me to understand that msgfmt was compiling .po files into "real" java objects How to use ResourceBundle
I've never seen that,internally generated?How does it work?
Can check what I meen here:
http://issues.apache.org/jira/secure/attachment/12401970/nutch_0.9_OR.patch
search "java~"
and you can see "java.old" there,what's that again?
It's probably some cruft leftover from emacs. With emacs, whenever you save a file, it saves a backup of the previous version of the file, and the backup is named with the original filename with a tilde appended to it. If this is the case (which you can easily verify by comparing file with file~), then you can safely ignore all of the files named with tildes.
Are you sure its generated from some java process? ~ in files typically means a temporary file created by editors, such as vim when you modify something.