Как открыть jar файл в intellij idea
Перейти к содержимому

Как открыть jar файл в intellij idea

  • автор:

Persistence tool window

If you have at least one module with the JPA facet in your project, you can use the Persistence tool window to view and manage various JPA items: configuration files, persistence units, and managed entities (persistent classes and fields).

The Persistence tool window

Navigate to entity definitions

To navigate from an entity in the Persistence tool window to the corresponding source code definition in the editor, do one of the following:

  • Double-click a field.
  • Select a field or class and press F4 .
  • Right-click a field or class and select Jump to Source .

Create new entities

Use the New action in the Persistence tool window to create XML configuration files, persistence units, entity classes and fields with their getters and setters, embeddable objects, mapped superclasses, entity listeners, object-relational mappings, and so on.

  • Select an item and press Alt+Insert .
  • Right-click an item and select New .

View entity relationship diagrams (ERD)

  • Right-click a managed entity and select Entity Relationship Diagram .

Associate persistence units with data sources

  1. Right-click a module, persistence unit, or entity, and select Assign Data Sources .
  2. Select necessary data sources for relevant persistence units and click OK .

With this association, IntelliJ IDEA will validate the source code that references database tables against the corresponding data sources. Also, the JPA console will use proper database connection settings, and you won’t need to specify them manually.

Associate persistence units with naming strategies

  1. Right-click a module, persistence unit, or entity, and select Assign Naming Strategies .
  2. Select necessary naming strategies for relevant persistence units and click OK .

Run JPQL queries

  • Right-click a persistence unit or entity and select Console or click in the toolbar Control+Shift+F10 .

This will open the JPA console where you can write and execute JPQL queries.

Generate persistence mappings

You can generate managed entity classes and object-relational mappings from a database schema represented by a data source, from entity beans in an EJB facet with an associated deployment descriptor file ejb-jar.xml , or from a Hibernate object-relational mapping file .hbm.xml .

  1. Right-click a module or a persistence unit, point to Generate Persistence Mapping and select By Database Schema .
  2. Select the source and output options and click OK .

Import Database Schema dialog options

Choose Data Source

Specify the destination package for your entity classes.

Specify one or more characters as a prefix for your entity class names.

Specify one or more characters as a suffix for your entity class names.

Prefer primitive types

Prefer primitive field types to object reference types (for example, prefer int to java.lang.Integer ).

Show default relationships

Analyze foreign keys in tables and suggest creating corresponding relationships (for example, one-to-one, one-to-many).

Database Schema Mapping

Select the tables and columns to be mapped. Edit the names of entity classes and their persistent fields (the Map As column). Adjust the field types (the Mapped Type column).

Add to Persistence Unit

Associate the generated entity classes with the selected persistence unit. Click to create a new persistence unit.

Generate Column Properties

Include column properties, such as length , nullable , and so on.

Generate Single Mapping XML

Store object-relational mappings for all the generated entity classes in one XML file.

Generate Separate XML per Entity

Create an individual object-relational mapping file for every generated entity class.

Generate JPA Annotations (Java 5)

Add mapping information to the source code of the generated entity classes as annotations.

  1. Right-click a module or a persistence unit, point to Generate Persistence Mapping and select By Entity Beans .
  2. Select the source and output options and click OK .

Import Entity Beans dialog options

Choose EJB Facet

Specify the EJB facet with an associated deployment descriptor file ejb-jar.xml .

Specify the destination package for your entity classes.

Specify one or more characters as a prefix for your entity class names.

Specify one or more characters as a suffix for your entity class names.

Prefer primitive types

Prefer primitive field types to object reference types (for example, prefer int to java.lang.Integer ).

Show default relationships

Analyze foreign keys in tables and suggest creating corresponding relationships (for example, one-to-one, one-to-many).

  1. Right-click a module or a persistence unit, point to Generate Persistence Mapping and select By Hibernate Mappings .
  2. Select the source and output options and click OK .

Import Hibernate Mappings dialog options

Choose Hibernate XML

Specify the Hibernate object-relational mapping file .hbm.xml .

Specify the destination package for your entity classes.

Specify one or more characters as a prefix for your entity class names.

Specify one or more characters as a suffix for your entity class names.

Add to Persistence Unit

Associate the generated entity classes with the selected persistence unit. Click to create a new persistence unit.

Generate Single Mapping XML

Store object-relational mappings for all the generated entity classes in one XML file.

Generate Separate XML per Entity

Create an individual object-relational mapping file for every generated entity class.

Generate JPA Annotations (Java 5)

Add mapping information to the source code of the generated entity classes as annotations.

Jar файл в Intellij Idea

В IDEA 9.0, соответственно, Project Structure → Artifacts .

В 10 не знаю, но, скорее всего, также должно быть.

А вообще для таких вещей есть ant, maven.

Отслеживать
71.4k 12 12 золотых знаков 91 91 серебряный знак 180 180 бронзовых знаков
ответ дан 18 дек 2010 в 21:22
530 3 3 серебряных знака 4 4 бронзовых знака
Спасибо, не могла найти, как это сделать в Idea 9.0. А про ант и т.д. известная вещь.
18 дек 2010 в 21:35

  • Intellij Idea >>> File >>> Project Structure >>> Artifacts
  • Нажимаете + Выбираете >>> JAR >>> From modules with dependencies >>> Main Clas
  • Выбираете Main >>> установите галочку на extract to output target JAR >>> OK >>> В Output directry выберите где будет находится файл
  • Установите галочку Include in project build >>> установите галочку Show content of element >>> Apply >>> OK

Затем заходим во вкладку Build >>> Build Artifact >>> выбираете свой проект и жмете Build

Отслеживать
6,998 6 6 золотых знаков 37 37 серебряных знаков 65 65 бронзовых знаков
ответ дан 28 авг 2018 в 4:11
165 1 1 золотой знак 1 1 серебряный знак 8 8 бронзовых знаков

  • java
  • jar
  • intellij-idea
  • jetbrains
    Важное на Мете
Связанные
Похожие

Подписаться на ленту

Лента вопроса

Для подписки на ленту скопируйте и вставьте эту ссылку в вашу программу для чтения RSS.

Дизайн сайта / логотип © 2023 Stack Exchange Inc; пользовательские материалы лицензированы в соответствии с CC BY-SA . rev 2023.12.8.2394

Нажимая «Принять все файлы cookie» вы соглашаетесь, что Stack Exchange может хранить файлы cookie на вашем устройстве и раскрывать информацию в соответствии с нашей Политикой в отношении файлов cookie.

Правильное добавление внешних JAR-файлов (lib/*.jar) в проект IntelliJ IDEA

Одной из распространенных задач при работе с Java в среде разработки IntelliJ IDEA является подключение внешних библиотек, которые располагаются в формате JAR-файлов. Эти файлы могут находиться, например, в директории ./lib/ .

Приведем пример. Представим, что в проекте используются внешние библиотеки, которые хранятся в виде JAR-файлов в папке ./lib/ . Для того чтобы эти библиотеки были доступны в проекте, необходимо корректно их подключить.

Подключение внешних JAR-файлов в проекте IntelliJ IDEA можно осуществить следующим образом:

  1. Открыть проект в IntelliJ IDEA.
  2. Перейти в меню File -> Project Structure или использовать сочетание клавиш Ctrl+Alt+Shift+S .
  3. В открывшемся окне выбрать пункт Libraries в левой части окна.
  4. Нажать на знак + в верхней части окна и выбрать Java .
  5. В открывшемся окне проводника найти и выбрать нужные JAR-файлы в директории ./lib/ , затем нажать OK .
  6. Нажать Apply и OK для сохранения изменений.

Теперь подключенные библиотеки доступны для использования в проекте. Они были добавлены в classpath проекта, что означает, что классы из этих библиотек можно импортировать и использовать в коде. О подключении библиотеки свидетельствует ее наличие в разделе External Libraries в структуре проекта.

как открыть открыть jar в intellij idea (преобразовать его в проект)

практически никак (если вы хотите вноить в этот проект изменения, а не просто смотреть его). Нужно искать исходники.

Похожие вопросы

Ваш браузер устарел

Мы постоянно добавляем новый функционал в основной интерфейс проекта. К сожалению, старые браузеры не в состоянии качественно работать с современными программными продуктами. Для корректной работы используйте последние версии браузеров Chrome, Mozilla Firefox, Opera, Microsoft Edge или установите браузер Atom.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *