Read SVN properties of a directory in Java or JavaScript - java

I have checked out a code repo on my windows machine. When I do the right click on the directory and go to properties I am able to see the Subversion Tab. There it has a button named Properties which when clicked shows a prompt having Subversion properties like svn:ignore. I was just wondering
If these properties have become directory properties now like last modified and all?
Can I read these properties using Java / JavaScript programatically?

Answers:
Not in the sense of - as you suggest - OS or file system level properties. These are Subversion's own properties and as such are managed by Subversion itself (or other software that can work with Subversion, like very probably in your case: TortoiseSVN. This is what provides you with the tab in the Windows file properties dialog you mentioned).
Yes, with Java, sure - using a library like JavaHL, which is a JNI wrapper around the native Subversion C code. You can get it as part of the Subversion package for Windows (the most recent version as of this post is 1.8.11). Other alternatives include SVNKit, which is a raw Java implementation. Since you're mentioning Javascript, I guess you're talking Node.js, so after a quick use of Google, I'd direct you to something called nodesvn.

Related

How run a java jar with a customize name or id in the cmd? [duplicate]

Our Java Swing application is running on Windows and wrapped in an exe file using Launch4J.
We would like to customize our application process name and description (in Windows' task manager) as it is currently "javaw.exe" and "Java Platform SE binary" (which is confusing for our customers).
While older versions of Launch4J enabled to change this using <customProcName>, this option is now defunct as it is not working anymore as of Win7.
Is there any other (simple) workaround to customize our application process name and description?
For instance, changing javaw.exe executable filename seems like an approach (as we embed it in the wrapped exe file) but how then indicate to launch4j that the jvm file name changed?
Another option could be to create a launcher exe file: maybe an overkill?
Any ideas / hints are more than welcome; thanks!
If you're looking to roll your own solution, you're going to want to look at JNI and the Invocation API in particular JNI_CreateJavaVM() which is used to create a VM, find the main method GetStaticMethodID() and invoke it with CallStaticVoidMethod.
This is what the java.exe, javaw.exe and a variety of other native launchers do internally. Some examples include:
OpenJDK java.c
IntelliJ WinLauncher.cpp
WinRun4J VM.cpp
If you want don't want to integrate a native build system with your java build system, an approach is to build a static launcher.exe in advance, and treat it as a static binary blob. Then during your java build, modify the binary blob using java, to update the VERSIONINFO, icon and splash screen. An example of this approach can be seen in IntelliJ LauncherGeneratorMain.java
If you can afford it, JSmooth seems to do what you need. It's last released in 2007 though. A note about its license taken from the app itself:
The executable generated (the launchers created by JSmooth) are under the LGPL with a "runtime exception" similar to the gcc licence exception: It is not required that you distribute the source code with it, nor that you publish a notice mentionning jsmooth.
When using JSmooth, there is a section labeled "Skeleton" that allows you to select some pre-defined parameters. One of them is a "Windowed Wrapper" that is fit for GUI applications described as follows:
This skeleton wraps GUI applications.
No console I/O is displayed
If no Java VM is found, it is able to display a configurable URL (typically to a java download page).
Arguments can be passed to the application (either use the JSmooth default argument mechanism, or create a shortcut with arguments).
The important thing in this skeleton is to check the option "Launch java app in the exe process" which results in running the JVM in the same process as the wrapper exe. This means only the exe is shown in the Windows Task Manager, as opposed to both the exe and the java process.
The alternative is to write your own wrapper. See this Oracle guide for how to invoke the JVM from a native application.
I did similar things with WinRun4J, as far as I remember it can be used commercially because it is CPL licensed. Checked this today: settings the process name still works (initially did this on XP) with Windows 7.
According to the website you simply create a ini file which tells WinRun4J what to run:
main.class=org.something.MyMainClass
classpath.1=*.jar
(there are many more parameters, you can set where the JRE can be found and more)
In a second step you copy the winrun4j.exe to something that fits your application:
copy winrun4j.exe yourapplication.exe
(There is a version for Windows x64 too)
Then you have RCEDIT (comes with WinRun4j) add the ini to the exe:
rcedit /N yourapplication.exe yourapplication.ini
This seems pretty old, and not really worth the effort, but it may also be what you are looking for: Java exe Maker.

How to optionally open last intellij project (or not) on startup?

I have just read this question:
Stop intellij opening projects on startup
Ideally, I would like to have 2 intellij icons on my desktop - one which opens the last project and one which doesn't.
In other words, I would like the flexibility of both functions.
Perhaps intellij has some command-line argument that specify which "mode" I desire on startup?
I'd rather not have to fire up an editor and edit the xml each time I start up IntelliJ.
File --> Settings --> Appearance '&' Behavior --> System Settings.
CLICK on System Settings, not a sub-tab, and uncheck the box that says "Reopen last project on startup."
As far as separate projects are concerned you could, perhaps, make a shortcut to the IML or intellij project file in it's respective directory to your desktop and use that. This way you could link as many projects as you'd like, though passing arguments to the intellij exe is also viable it may be a bit impractical. A plugin would most likely be best to automate that process, but I don't know the technicalities so take these tips with a few grains of salt.
EDIT: I also think it's worth mentioning that intellij's settings, as is the spirit of java, has pretty close to uniform and connected preferences accross platforms whether windows or linux or mac, but extending features have to be made compatable to the specific platform if it utilizes a native function (like passing parameters to an exe in windows or doing the same with an shell script in linux.)

How to configure IntelliJ for Mac to show Java and Android documentation within the editor (offline, not online)?

How do I configure IntelliJ to access offline documentation (for both Java and Android if possible) without leaving my IDE? I'm using IntelliJ IDEA 13.1. My Android application is building and running fine so my installation seems to be correct. I've examined the relevant SO posts:
How to view JDK external documentation in IntelliJ IDEA?
JDK documentation in IntelliJ IDEA on Mac OS X)
IntelliJ and the android java docs
But either the paths they recommend are not on my machine (the posts are rather dated) or else too vague. Interestingly my /Library/Java/JavaVirtualMachines folder seems to be empty whether I use Finder or Terminal. My Documentation paths tab under the File | Project Structure menu item is empty.
I should add that I'm attempting to use the Shift+F1 keyboard command when I have a keyword highlighted. That's what is recommended, but nothing happens. Below are pics of my current documentation paths in the Project Structure dialog. All done according to recommendations as far as I can see, but maybe someone can spot something.
I think configuring the path to src.zip should be enough, IntelliJ will retrieve the Javadoc from the source files. In Modules Settings, in the SDKs panel choose your current SDK, go to the Sourcepath tab and make sure there's an entry for src.zip.
On OSX it's located under
/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/src.zip
or
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/src.zip
depending on which SDK you have and how you installed it.
For the Android doc, I guess you can do the same if they provide a zip containing all the source files.
Command + ; open Project Structure
on left panel select SDKs
in Sourcepath tab click +, select your src.zip

Eclipse RCP: application specific folder

I have an RCP application in Eclipse 4.x for a cross-platform software. I would like to place the osgi.instance.area in the application specific folder. For example on Windows it generally is C:\Users[Username]\AppData[Name]. Something similar to the directories outlined here - http://www.chromium.org/user-experience/user-data-directory.
I have seen the solution here - https://bugs.eclipse.org/bugs/show_bug.cgi?id=241192 but I haven't understood it really well. I use the product editor on Eclipse and under the Configuration tab, I have added the osgi.instance.area property in the Properties section with another directory at the moment.
Then I tried the solution from the bug - $APPDATA$/COMPANY/PROGRAM/instance but I couldn't find the directory anywhere at the expected location. Also, how does this work for Linux and Mac OS X?
In Windows 7 and 8 $APPDATA$ is C:\Users[Username]\AppData\Roaming. In Linux $APPDATA$ is undefined. You should use #none, #noDefault, #user.home, #user.dir, filepath or url
I think it is the osgi.instance.area.default property that you should set. The value migght be something like #user.home/Documents/workspace

Can multiple people work on the same project?

Can me and my other friend programmer work on same project with Eclipse synchronizing it, or we need to share the src every 10 minutes?
You can certainly use the "Team" menu, which gives you access to version control systems. I would recommend Git or Mercurial (Distributed Version Control Systems).
EGit/JGit are now part of the mainstream plugins: you can install them using the "Indigo" repository (assuming Eclipse 3.7) in "Install new software...".
Centralised Version Control Systems (like CVS or SVN) also have plugins for Eclipse. They might, however, make it more difficult to branch and merge conflicts when required.
You are looking for a version control system (VCS) like CVS, SVN, Git, Mercurial, etc.
It seems like you are asking if Eclipse has support for sharing workspaces so that you and your friend can (in essence) cooperatively edit and run the same set of java files in real time.
Something like this - http://www.readwriteweb.com/cloud/2011/07/cloud9s-web-based-real-time-co.php
The answer is No. Eclipse doesn't support this directly.
However, there is an Eclipse plugin / project called Saros that claims to do this. And the Saros site has links to related projects that may be relevant.
(FYI - the relevant search terms are "collaborative programming".)
This is what you need:
http://en.wikipedia.org/wiki/Revision_control
SVN or CVS - kind of version controlling system will help u to work together or u want to maintain your repository online then kindly check out https://stackoverflow.com/questions/59791/free-online-private-svn-repositories link.
I use SVN Notifier which sits in the system tray and notifies me every time the repository changes. And I can highly recommend it. It means you only update when there's something to update!
Alternatively you can set up a scheduled task/cron job to run svn update in the appropriate directory every hour/day/whatever.
refer this Microsoft article on setting up a scheduled task.
You want a batch file called svnUpdate.bat or something which looks like this:
cd C:/path/to/your/working/copy
svn update
Get the scheduled task to run this as often as you like (once an hour seems sensible)
Make sure you have the command line version of svn installed (I use SlikSvn) and available on your PATH (in a command window type svn and ensure it says 'Type svn help...' or similar.

Categories

Resources