[Lib][Java/JAR] RegIOLib - Java/Registry In/Out Communications Lib

Search This thread

Beatsleigher

Senior Member
Hey there,

I thought it was time to release something new :)

A bit of background storyline:

My last projects were all VB/.Net programs, and they were somewhat great, sure. But I was missing the Linux portability and the programs aren't available on all Windows version - Which bugged me a lot. So I finally started coding in Java again! I'm also porting Universal Android Toolkit to Java, so I can easily create a Linux version of that as well.
(If you want to make that happen faster, please donate to me. I managed to fix my laptop, but I've only got a 60GB HDD and I need that much space alone for Windows and I have no income, I'm only 16 :p )

Anyways, now that you know where I'm coming from, as I'm porting Universal Android Toolkit to Java, I need access to the registry to save the application's settings and easily access them. But unlike .Net languages, Java doesn't have built-in support for this kind of operation, so I looked around and grabbed bits and pieces of code and stuck them together into a Java Class Library.

Thus, RegIOLib was born.

It's licensed under the GPL 3.0 (License info included in the source).

Downloads
Sourceforge

Source Code
http://github.com/Beatsleigher/RegIOLib

EDIT:
I forgot to mention the following: To get access to the Windows registry, the application needs to be started with administrative rights!
You can either achieve this by starting the app via a launcher (Which is what I tempt to do) or by right-clicking the file and allowing it to run as admin.
 
Last edited:
  • Like
Reactions: TiesB

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
Berlin, Germany
www.nikwen.de
Of course they can use it :)
Just add a link to this thread and my website, done.

But if you're coming from some major company or something, then I would like something more :)

According to the GPL they can't because it requires the source code of derivative work to be published. That's the "problem" with that license if you use it for libraries.

Due to that the LGPL exists.
 

SixSixSevenSeven

Senior Member
Dec 26, 2012
1,617
318
http://www.tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)

Limited commercial use. Must include source code. So no, GPL libraries and closed source applications do not mix.


An inelegant solution (which is the one I have always used actually) is to save settings in a file in %APPDATA%, no admin rights are required to edit files in there, or roll your own registry library for the application. Or Beatsleigher could LGPL it, but its his project, his license, I think he has full right to stick it under GPL if he wants to.




Although I dont think saving into a registry key is really cross platform :p Neither is %APPDATA% but using the %APPDATA% method is simple file read/write so on a cross platform application you can simply change the filepath dependent on the current execution environment.
System.getenv("APPDATA") will return the filepath for the current users APPDATA folder on windows. System.getProperty("user.home") works on linux and I think OSX to get the home directory. I dont think user.home works properly on windows. But it should be easy to switch between the 2 methods, add on an extra bit for where your settings file is and detect which to use at runtime.

Disadvantage (and to some advantage, depends on what the application is doing and whether the author likes it or not) is that saving configuration files as actual files means the user can play around with them. APPDATA is by default a hidden folder. But chances are most users dont even know what the registry is so in a way your settings might be more secure left in there.

Even possible to have an application load settings from the registry on windows and files on everything else.
 
Last edited:

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
Berlin, Germany
www.nikwen.de
Or Beatsleigher could LGPL it, but its his project, his license, I think he has full right to stick it under GPL if he wants to.

Of course, he has that right. It's his code. The GNU even collected some reasons for sticking with the GPL.
Just wanted to point out that the GPL says that all derivative work (which includes programs that use libraries licenced under the GPL) must be GPL'ed (and therefore open source'd), too. ;)
 

Beatsleigher

Senior Member
http://www.tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)

Limited commercial use. Must include source code. So no, GPL libraries and closed source applications do not mix.


An inelegant solution (which is the one I have always used actually) is to save settings in a file in %APPDATA%, no admin rights are required to edit files in there, or roll your own registry library for the application. Or Beatsleigher could LGPL it, but its his project, his license, I think he has full right to stick it under GPL if he wants to.




Although I dont think saving into a registry key is really cross platform :p Neither is %APPDATA% but using the %APPDATA% method is simple file read/write so on a cross platform application you can simply change the filepath dependent on the current execution environment.
System.getenv("APPDATA") will return the filepath for the current users APPDATA folder on windows. System.getProperty("user.home") works on linux and I think OSX to get the home directory. I dont think user.home works properly on windows. But it should be easy to switch between the 2 methods, add on an extra bit for where your settings file is and detect which to use at runtime.

Disadvantage (and to some advantage, depends on what the application is doing and whether the author likes it or not) is that saving configuration files as actual files means the user can play around with them. APPDATA is by default a hidden folder. But chances are most users dont even know what the registry is so in a way your settings might be more secure left in there.

Even possible to have an application load settings from the registry on windows and files on everything else.

No, as far as I'm aware, only Windows has a registry. I could be wrong though. In the past 5-6 years that I've been developing, I was only developing in VB.Net - A decision that I highly regret nowadays :(
But I'm so used to being able to save my settings in the registry where no 'normal' user can modify them and cause the program to misbehave, that I'd like my java programs to do so as well.

And seeming as Universal Android Toolkit is a big, big project (I've been developing it for over a year now and I'm constantly adding new features and now I'm porting it to Java making it really hard to release, but I'll get there eventually.

As soon as I've got the major stuff sorted out, I think I'm ready to release a Pre-Release candidate for testing and bug-fixing, but like I said, I'm still having some trouble and then I need to figure out a way to get those settings saved on Mac OS and Linux machines, for which I've already written some classes, but only to install ADB and stuff... And I'm getting side-tracked again, aren't I?

Anywhosers, I think I'm going to leave it under the GPL, even though you're right and that that means that closed-source programs can't use it, but I'll think of something. Even if it's a commercial license, say someone pays 2$ per program. I don't know.

But for the thing you said with %AppData%, what you can do on Linux machines, is (in Java)
Code:
private final String userProf = System.getenv("user.home");
final File tempDir = new File(userProf + "/Temp/(.)<Program>/temp.file");

private void setupTempDir() {
    Path tmp = tempDir.getParentFile().getPath();
    if (!tmp.exists()) {
        tempDir.createNewFile();
    }
}

That should solve that problem, then you COULD create some sort of settings file, but then it's just a pain to get and save the settings when you're using multiple GUIs, like me.

And then there's another way of doing that in Android apps, which I haven't figured out yet, mainly because I haven't even started with Android apps and I don't have the hard drive space to do so :/
 

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
Berlin, Germany
www.nikwen.de
Anywhosers, I think I'm going to leave it under the GPL, even though you're right and that that means that closed-source programs can't use it, but I'll think of something. Even if it's a commercial license, say someone pays 2$ per program. I don't know.

OK, no problem. ;) The GPL, however, says that you may not relicense it. :/
(All of my comments I've posted yet sound as if the GPL is a bad license. To clarify that: I don't think so. I prefer it for applications, but use the LGPL or Apache v2 license for libraries.)
 

Useless guy

Retired Recognized Developer
Jan 22, 2010
248
70
Moscow
(If you want to make that happen faster, please donate to me. I managed to fix my laptop, but I've only got a 60GB HDD and I need that much space alone for Windows and I have no income, I'm only 16 :p )

I'm 17 and I have a 64GB SSD. C#, C++ works great.

Anyway 700 lines of license make no sense. The same about the portable registry library for linux. Could you tell the purpose of it?
 

SixSixSevenSeven

Senior Member
Dec 26, 2012
1,617
318
I'm 17 and I have a 64GB SSD. C#, C++ works great.

Anyway 700 lines of license make no sense. The same about the portable registry library for linux. Could you tell the purpose of it?

GPL isn't 700 lines last time I checked, also I left a link to a simple description of it above (I do love tldrlegal).

There is no registry for linux, no one mentioned a portable registry for linux.
 

Useless guy

Retired Recognized Developer
Jan 22, 2010
248
70
Moscow
GPL isn't 700 lines last time I checked, also I left a link to a simple description of it above (I do love tldrlegal).

There is no registry for linux, no one mentioned a portable registry for linux.

I did
Anyways, now that you know where I'm coming from, as I'm porting Universal Android Toolkit to Java, I need access to the registry to save the application's settings and easily access them.
 

Beatsleigher

Senior Member
OK, no problem. ;) The GPL, however, says that you may not relicense it. :/
(All of my comments I've posted yet sound as if the GPL is a bad license. To clarify that: I don't think so. I prefer it for applications, but use the LGPL or Apache v2 license for libraries.)

I'm working on a license for it and any other such things. So I'll release it again for commercial and closed-source programs when it's done.

And yes, it does sound like you think it's a bad license. But meh. Everyone has their own opinion, I guess.

:p
 
  • Like
Reactions: nikwen

Beatsleigher

Senior Member
I'm 17 and I have a 64GB SSD. C#, C++ works great.

Anyway 700 lines of license make no sense. The same about the portable registry library for linux. Could you tell the purpose of it?

GPL isn' 700 lines.

That's cool for you, that you've got that stuff. I don't. Anyways, I'm getting away from .Net languages, and C# is easy for anyone to learn. Especially if they're coming from VB, like me.
C++ isn#'t my kinda thing, as you can't natively create GUIs in it. You always need some kind of library for that sort of stuff.

And I didn't intend this for use with Linux. Everyone that has basic knowledge of these operating systems knows that Linux, BSD, Mac OS etc. don't have registries. And I never even noted that I'm attempting to use registry stuff in Linux. I said I'm porting Universal Android Toolkit to JAVA, and that I need access to the WINDOWS registry to save the application's settings in the reg, so that users can actively change the settings if the program starts misbehaving.
 

SixSixSevenSeven

Senior Member
Dec 26, 2012
1,617
318
C++ isn#'t my kinda thing, as you can't natively create GUIs in it. You always need some kind of library for that sort of stuff..

Errm, those libraries are written in C or C++... native code such as C and C++ are the only languages which can create GUI's. VB.net/C#/anything else .NET use libraries too which in the case of WinForms and WPF are just wrappers around win32 functionality implemented in C.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hey there,

    I thought it was time to release something new :)

    A bit of background storyline:

    My last projects were all VB/.Net programs, and they were somewhat great, sure. But I was missing the Linux portability and the programs aren't available on all Windows version - Which bugged me a lot. So I finally started coding in Java again! I'm also porting Universal Android Toolkit to Java, so I can easily create a Linux version of that as well.
    (If you want to make that happen faster, please donate to me. I managed to fix my laptop, but I've only got a 60GB HDD and I need that much space alone for Windows and I have no income, I'm only 16 :p )

    Anyways, now that you know where I'm coming from, as I'm porting Universal Android Toolkit to Java, I need access to the registry to save the application's settings and easily access them. But unlike .Net languages, Java doesn't have built-in support for this kind of operation, so I looked around and grabbed bits and pieces of code and stuck them together into a Java Class Library.

    Thus, RegIOLib was born.

    It's licensed under the GPL 3.0 (License info included in the source).

    Downloads
    Sourceforge

    Source Code
    http://github.com/Beatsleigher/RegIOLib

    EDIT:
    I forgot to mention the following: To get access to the Windows registry, the application needs to be started with administrative rights!
    You can either achieve this by starting the app via a launcher (Which is what I tempt to do) or by right-clicking the file and allowing it to run as admin.
    1
    OK, no problem. ;) The GPL, however, says that you may not relicense it. :/
    (All of my comments I've posted yet sound as if the GPL is a bad license. To clarify that: I don't think so. I prefer it for applications, but use the LGPL or Apache v2 license for libraries.)

    I'm working on a license for it and any other such things. So I'll release it again for commercial and closed-source programs when it's done.

    And yes, it does sound like you think it's a bad license. But meh. Everyone has their own opinion, I guess.

    :p
    1
    C++ isn#'t my kinda thing, as you can't natively create GUIs in it. You always need some kind of library for that sort of stuff.
    Lolwhat?