Can't update java.security file - want to add bouncy castle provider - java

I am trying to use 'Bouncy castle' library in JAVA and want to add that jar file(bouncy castle's) to the providers list in the 'java.security file', I'm using windows7 and I have changed the permissions too for the files and folders but yet I'm getting an error "Access to 'complete-path' was denied". Kindly help me in how to deal with this error.

You can only save edits made to a java.security file if the editor you are using is running as an administrator.
Notepad is sadly not good enough for this job, as Notepad only supports files with CR+LF line-endings and java.security uses LF line endings. I normally use Notepad++ for this task, although Notepad2 and various other programmer's editors can be used instead if that's your preference.
Note that you must quit Notepad++ if it is currently running. If Notepad++ is running and you attempt to start another copy of it (as administrator or otherwise), Notepad++ will figure out that it is already running and instead give focus to the already-running copy of Notepad++.

The solution for me was to copy the file somewhere else, update it and paste it back in. There is a security warning that I had to say 'continue' to.

Related

Recover overwritten JAVA file

I was making a jar file but accidentally wrote TimerV1.java instead of TimerV1.jar and as a result, my whole source code got replaced with machine code and the sad thing is there's still something I have to edit.
I am using Notepad++ and tried searching the Roaming directory but there's nothing there.
I also tried decompiling the jar file and editing the exported source files (with JD-GUI) but when I try to compile those source files I get errors that I don't even know how to resolve.
Is there any way to recover the previous versions of my java file?
You can use JAD (Java Decompiler) but.. not all code can be reversed into source.
Try one of:
http://jd.benow.ca/
https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler
http://www.benf.org/other/cfr/
https://github.com/fesh0r/fernflower
http://www.javadecompilers.com/jad
I don't use Notepad++ myself but it seems there is a backup folder where older versions of edited files are kept:
C:\Users\<user>\AppData\Roaming\Notepad++\backup
There are various utilities out there that can recover deleted files, I think because typically they are still there but the OS lists that space as unallocated. But overwritten files...I wish I had a better answer but I don't know if they can be recovered, unless some version was saved somewhere.
If it was a relatively short file, maybe the best thing to do is take this as an painful opportunity to use a backup service like Carbonite or Dropbox, and use version control like Git or SVN.
Nevermind. I have used another decompiler and debugged one by one. Thanks to those who answered :)
I used Cavaj Decompiler.

How do I clear a specific file in the Java cache?

I would like to remove a specific cached jar file from a Java program. Java cache behaves weirdly sometimes, and keeps loading an old jar even if a new one should be used.
The "Java Control Panel" has a "Java Cache Viewer" feature that allows us to see cached jar files.
I was wondering if there was a way to detect a cached jar file but directly from a java program, and then remove that file. Is there an API allowing that?
Yes! I've just found a solution to this problem. There's a command line statement "javaws" that let's you handle specific java-related actions. You can type javaws into your console/terminal and it'll give you options but to remove a specific application, you could add this to your code:
Runtime.getRuntime().exec("javaws -uninstall <jnlp file>");
where can be the file or a url.
Hope this helps!
See http://download.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/applet_caching.html for ways to control the cache.

Files edited outside the ide

If I run a script to edit files outside of the ide I am using, will the ide recognize the changes made to the files?
More specifically:
-IDE: Netbeans 6.8
-Version Control: CVS
-OS: Windows XP
In general, yes. But the form designer of NetBeans considers some parts of the code "private", and you shouldn't modify these parts externally. They are identified by comments in the generated code:
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
These parts are in fact generated from an external proprietary .form file, and having the source code not aligned with the .form code will mess everything up.
Yes it should. Give it a whirl and check it out.
Yes, with some caveats:
If you have those files open, edited, and unsaved in the IDE at the time, then you will need to tell the IDE whether to discard or keep your in-IDE changes.
If you have them open and unedited, then depending on the IDE, you may have to tell it to reload those files (the IDE should warn you that the file has changed since you last opened it).
If you move files around, and your IDE has some kind of project file (that tells it, among other things, where all the files are) and you don't update it accordingly, you may have problems.
Any files that you don't already have open in your IDE should behave as expected, and I would consider it a bug if it didn't pick up the changes.

When trying to open a .java file from windows explorer I get a "No project found to open file in" error message

So, when I double click a file in windows explorer, Intellij fires up, but instead of just showing me the file I want to see, shows up the following message:
I think I get what it means: it means this given .java file isn't associated with an Intellij project.
That's actually true, but even so I'd like to be able to open the file and see it with syntax highlighting and such.
How to overcome this problem?
Thanks
It's a known limitation which we plan to address in the future versions to allow opening and editing individual files without project context.
Please watch/vote the related issue.
I don't think you can'tcan by default. I'm assuming you are opening downloaded files or such. What I would is create a project (Scrapbook for example is a good name) on desktop and I would put/download the file I want to see in the corresponding src folder. That way when I'm clicking it would open properly.
Most of the syntax highlight and such goodness of idea comes from a proper project setup (proper JDK paths, libraries, etc).

Hiding specific files in TextMate

I do a lot of JRuby on Rails apps, and we have a fair amount of Java .jar dependencies. These become quite annoying in textmate as it really muddies up my lib directory, and I never (obviously) need to actually open these files.
Can someone tell me how I might hide .jar files from my file listing in Textmate??
You need to modify File Pattern regex in :
TextMate-->Preferences-->Advanced-->FolderReferences
You just have to add |\.(jar) to your regex:
!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|\.(jar)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
Have a look at this.
You can do this for a specific Textmate project too:
Save the project somewhere, for example in myproject.tmproj.
Make sure the project isn't open in Textmate (otherwise Textmate will overwrite your changes when you close the project)
Open up the myproject.tmproj file with a different text editor
Add a pattern for the files you want to ignore to the <string> value on the line immediately following the regexFolderFilter line. In this case you would add |\.jar just before the )$</string>.
Save the file.
Re-open the project in Textmate.
You can also open the .tmproj file in step 3 with Textmate if you use the command line command mate, too.

Categories

Resources