Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When JabRef is started, load the library in the folder of JabRef.bat #377

Closed
koppor opened this issue Nov 21, 2019 · 8 comments · Fixed by JabRef/jabref#12172
Closed

When JabRef is started, load the library in the folder of JabRef.bat #377

koppor opened this issue Nov 21, 2019 · 8 comments · Fixed by JabRef/jabref#12172
Assignees
Labels

Comments

@koppor
Copy link
Member

koppor commented Nov 21, 2019

  • If there is no previously opened library in JabRef AND
  • If a single bib file exists in the startup directory of JabRef

THEN: this should be opened (use case: portable jabref used in a research group)

@K5qu4r3d
Copy link

K5qu4r3d commented Apr 7, 2023

@koppor I'd like to take a look into this issue. I presume this is still part of the larger JabRef project issues list even though this one is among the issues list of your fork.

I have a couple of questions.

  • What determines the startup directory of JabRef?
  • JabRef.bat is located in the runtime/bin/ directory as of the latest development version. Considering that directory is entirely code compilation (?) files, should one be saving/loading files to/from there?

Also, any guidance would be appreciated as I am a novice to the project - I've worked on #9370 but I'm just coming back to working on it after some time.

@koppor
Copy link
Member Author

koppor commented Apr 7, 2023

Kevin, thank you for choosing JabRef. This issue is a one where not much code is to be written, but much experiments being done. Please choose this issue only if you intend to contribute more to JabRef. Or if you intend to keep working in the Java space. If not, I would recommend to switch to another issue.

Idea of the issue: JabRef is not installed globally, but as portable version

Reproduce the idea:

  1. Go to https://builds.jabref.org/main/
  2. Download the Windows portbale zip file (currently, this is https://builds.jabref.org/main/JabRef-5.10-portable_windows.zip)
  3. Create directory c:\temp\377
  4. Extract the zip-file into that directory
  5. Check that the result is as follows
    image
  6. Create a file demo.bib
  7. image
  8. Rename file by selecting it, pressing F2
  9. image
  10. And then typing "test.bib" and deleting .txt
    7: Check that that file exists:
    image
  11. Note that creating test.bib can be done in another way. In my case, I enabled showing the file extensions in Windows Explorer. That way, it was easy for me to replace .txt by `.bib?

Now, start JabRef by double clicking the .exe. JabRef should start.

Now, you need to make a modified version of JabRef:

  1. Go to /src/main/java/org/jabref/cli/Launcher.java#L49
  2. Add System.out.pritnln("Current directory " + Path.of("").toAbsolutePath().toString()); (inspired from https://stackoverflow.com/a/51028045/873282)
  3. Prepare a portable zip file by the gradle jlinkZip task
    image. Will take a long time. Here, it was 4 minutes. Ignore the warnings.
  4. Now execute jpackage
  5. Then, in the folder build\distribution\JabRef, you will find the .exe
  6. Open a CMD.exe and run it
  7. See that nothing is output
  8. Then see that there is a logger initialized
  9. Add logging at this place (instead of System.out.println) to have the output appearing in log.txt (howto at https://devdocs.jabref.org/code-howtos/logging.html)

Step 9 will teach you how logging works (how to configure it, where to find log.txt, ...)

@K5qu4r3d
Copy link

K5qu4r3d commented Apr 8, 2023

Understood. Given what you mentioned, and given that the "Good First Issues" tag was removed from this issue, it seems best for me to look at other ones - I do want to contribute more to JabRef and further my Java experience.

Also, on the error idea-reproducing steps, when I get past this step...

Add logging at this place (instead of System.out.println) to have the output appearing in log.txt

...and run JabRef.exe after repeating steps 3) through 6) above it, I get this error:

image

@koppor
Copy link
Member Author

koppor commented Apr 8, 2023

Kevin, this is a good first issue to step into the build process. - I removed the label "good first issue", because it is no real quick win. You are very invited to continue to learn about the Java eco system.

The next step would be: Checkout main branch - and create a portable app based on that. Does that .exe from that distribution run?

In case you are familiar with a debugger, working on JabRef#9738 could also be nice.

@K5qu4r3d
Copy link

Kevin, this is a good first issue to step into the build process.

Okay. I'm more than happy to continue working on this as much as I can.

The next step would be: Checkout main branch - and create a portable app based on that. Does that .exe from that distribution run?

So turns out I was doing the reproducing steps on the main branch (instead of a separate one) and made a few changes to Launcher.java and tinylog.properties 😅

I've since shelved those changes and updated the branch with the latest changes.

Anyway, after running jlinkZip and jpackage from the main branch, the .exe from this distribution successfully runs and the app loads.

In case you are familiar with a debugger, working on JabRef#9738 could also be nice.

I'll take a look.

@jiaxin0103
Copy link

Hello, I am a student at the Australian National University. For our team project, we need to contribute to an open-source project. May I be assigned to this task?

@koppor
Copy link
Member Author

koppor commented Oct 14, 2024

@jiaxin0103 Sure. Please be aware this is more than Java coding, you need to build a portable distribution of JabRef to test.

@koppor
Copy link
Member Author

koppor commented Nov 13, 2024

@jiaxin0103 I was wrong, it was more a thing of coding 91 lines of code needed. - I implemented at https://github.com/JabRef/jabref/pull/12172/files

@github-project-automation github-project-automation bot moved this from Free to take to Done in Good First Issues Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants